A Little Help Please?

3772
8
04-21-2015 02:20 PM
LarryStout
Occasional Contributor III

Thanks to all who replied.  I really do appreciate you!  Sorry for the code that didn't work very well.

I've rewritten my code that detects touch and mouse.  This time I'm not going to post until I've tested on the one device I can get my hands on: a Microsoft Surface tablet.  Look for A Little Help Please? [Part Deux] tomorrow if my Surface test goes well.

I've noticed more and more devices that have both touch screens and a mouse.  My research tells me this is either impossible or very difficult to detect.  I always love a challenge, so I wrote some code that I think will detect this.  I am using Dojo has('touch') to detect if the device has a touch screen.  This works on all of the devices I've tested.  The code to detect a mouse on a touch device is the tricky part, and I don't have access to any devices to test this on.  Here's how you can help if you have such a device.

I have a customized WAB Application.  In the lower left corner, above the scalebar, I am showing what devices I have detected:

Debug.PNG

1. Go to this link: MapViewer1.1-DEV-TEST-MOUSE

2. DO NOT USE YOUR MOUSE

3. Open some widgets, zoom, pan, tap a parcel, etc.

4. Verify that the debug reads as above: hasMouse: false (or undefined), hasTouch: true

5. NOW USE YOUR MOUSE

6. Verify that the debug reads: hasMouse: true, hasTouch: true

7. If the app doesn't detect the mouse or if there are any problems, let me know.

8. It would be cool to know the operating system and version (e.g. iOS 8.2, Android 4.1, Windows 8, etc.)

If the testing goes well, I plan to share the code for this with the community, but feel free to scrape it.  Acme/Widget/js, lines 207-237

Thanks,

Larry

0 Kudos
8 Replies
RebeccaStrauch__GISP
MVP Emeritus

​Hi Larry,

testing on ipad with ios 8.3 (last weeks update).   First time trying to load, never got past the "loading..." Icon, but a refresh did.

on initial load (both incomplete and refresh) the    hasMouse showed "undefined" until I touched on the screen and it changed to false.  I'm assuming that is expected behavior.  hasTouch was true.

I do not have a mouse, but tested my JOT Script pen, just to see, but it sees it as touch too, not mouse (which makes sense).

a simple test result, for what it's worth.

0 Kudos
LarryStout
Occasional Contributor III

Thanks Rebecca.  Every little bit helps!

0 Kudos
SepheFox
Frequent Contributor

I'm not sure if my device qualifies. It's a laptop with a touch screen and track pad. Although I only used the touch screen it continuously showed touch = false. Obviously the same occurred when I used the track pad.

0 Kudos
LarryStout
Occasional Contributor III

Sephe,

Your device absolutely qualifies.  Sounds like I have some work to do with touch screen laptops.  Are you using Windows or a Mac?

Larry

0 Kudos
SepheFox
Frequent Contributor

Windows 8. I should have mentioned that it said mouse = true the whole time, even while using the touch screen.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Larry,

  Platform: HP Elite Tab - Windows 8.1

  Browser: IE 11.0.9600.17690 & Tested in Windows Metro as well.

Tested using touch first:

  HasTouch: True

  HasMouse: false

I have a bluetooth mouse connected as well and it still says HasMouse: false.

0 Kudos
LarryStout
Occasional Contributor III

Robert,

It's listening for a mousemove event over the browser window, so it won't change to hasMouse: true until it detects that event.  Did you try moving the mouse over the map?

Larry

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Larry,

   Yep used my mouse to zoom and to interact with widgets.

0 Kudos