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:
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
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.
Thanks Rebecca. Every little bit helps!
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.
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
Windows 8. I should have mentioned that it said mouse = true the whole time, even while using the touch screen.
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.
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
Larry,
Yep used my mouse to zoom and to interact with widgets.