fredsa / playn

Cross platform game library for N≥4 platforms
0 stars 1 forks source link

HTML Pointer events aren't triggered by a mouse on desktop devices with a touchscreen #175

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Devices with both a mouse and a touchscreen will not fire Pointer events from 
the mouse.

This is due to our check in HtmlPointer where we do not capture mouse events if 
touch events are available. At the moment, mobile browsers send both touch and 
mouse events so this is fine, but desktop browsers only send touch.

I don't think we (PlayN) can or should fix this until desktop/mobile browsers 
get in sync so this bug is simply to track that issue.

Original issue reported on code.google.com by pdr@google.com on 25 May 2012 at 1:23

GoogleCodeExporter commented 9 years ago
It looks like it is no longer true that touch events fire mouse events on 
mobile browsers. I tested the following:
Chrome beta for android
Firefox beta for android
Android browser
Opera for android

Waiting for an update from an iPhone user. If mobile Safari has the same 
behavior (just ontouchstart, no onmousedown), I'll put up a patch to modify 
HtmlPointer.

Original comment by pdr@chromium.org on 25 May 2012 at 1:41

GoogleCodeExporter commented 9 years ago
iOS is different so this won't be as simple as I thought. Off to buy an iPad to 
test this for real...

Original comment by pdr@google.com on 25 May 2012 at 2:44

GoogleCodeExporter commented 9 years ago
An excellent excuse! :)

Original comment by m...@samskivert.com on 25 May 2012 at 3:44

GoogleCodeExporter commented 9 years ago
Review request: Add mouse and touch listeners in Pointer, and a new test:
http://code.google.com/r/pdr-playn/source/detail?r=5c883b868997c6daeb1742626b87d
46b625a35eb&name=inputfix#

You can view it here (only modified to show the single test):
http://testtouch1.appspot.com
http://testtouch1.appspot.com/?renderer=canvas

Browser test results:
Safari Mobile: works as expected (!!!)
Chrome on Android: works as expected
Firefox Beta on Android: works as expected
Android browser: works as expected
Win7 with Chrome21 (--enable-touch-events) and touchscreen: fails with two 
events on Touch due to crbug.com/129638. This is being fixed right now.

Our tricky preventDefault business in Pointer / Touch has the effect of always 
preventing default for touch events (i.e., you can't pinch-zoom). I'm not a fan 
of this but it does mean that everything works as expected and nobody regresses 
from this change.

Useful page for playing with touch events: http://www.rbyers.net/eventTest.html 
(note: prevent default "PD" checkbox is on by default).

Original comment by pdr@chromium.org on 26 May 2012 at 1:50

GoogleCodeExporter commented 9 years ago
LGTM. Do you mind if I merge this patch? I just refactored the Touch code to 
add support for per-layer Touch listeners and in the process I factored a bunch 
of repeated code out of HtmlTouch, so it would be easier for me to replicate 
your change (enable both sets of listeners) after that merge rather than 
replicate my change after.

Original comment by m...@samskivert.com on 26 May 2012 at 7:38

GoogleCodeExporter commented 9 years ago
SGTM!

Original comment by pdr@chromium.org on 26 May 2012 at 7:49

GoogleCodeExporter commented 9 years ago
Oh, wait, nevermind. My changes were to HtmlTouch, not HtmlPointer. Your patch 
merges totally cleanly, so you might as well just pull the latest bits into 
your repository and then merge this branch into your master and push it 
upstream. No need for my meddling. :)

Original comment by m...@samskivert.com on 26 May 2012 at 8:09

GoogleCodeExporter commented 9 years ago
Oh, wait, nevermind. My changes were to HtmlTouch, not HtmlPointer. Your patch 
merges totally cleanly, so you might as well just pull the latest bits into 
your repository and then merge this branch into your master and push it 
upstream. No need for my meddling. :)

Original comment by m...@samskivert.com on 26 May 2012 at 8:16

GoogleCodeExporter commented 9 years ago
Got delayed by beautiful vacation weather. Landing in just a few.

Original comment by pdr@chromium.org on 30 May 2012 at 12:27

GoogleCodeExporter commented 9 years ago
Thanks for the review!

We've landed:
http://code.google.com/p/playn/source/detail?r=9ce53a9910c38f242f79d5f8226685658
35cd6a6#

I'm going to mark this as fixed. If anyone runs into issues with this, please 
create a new bug and assign it to me, or just re-open this bug.

Original comment by pdr@google.com on 30 May 2012 at 1:04