Ed
On Monday, November 5, 2012 10:57:44 AM UTC-8, emurmur wrote:
-- On Monday, November 5, 2012 10:57:44 AM UTC-8, emurmur wrote:
I took a quick look at the code you linked to in stackoverflow. I think the code as written has a few problems.(NOTE: I'm looking at code I wrote using the Elemental library as reference, so some of the calls might be different in the user library).a) The code is not filtering touches aimed at the button; it calls TouchEvent.getTouches(). You want to call TouchEvent.getTargetTouches() on touchstart and touchmove to get the the touches just for your button. You want to call TouchEvent.getChangedTouches() on touchend to get the end touch. b) The code does not take into account multitouch. On touchstart, you can check that a single touch is available and bail out if there is more than one. Also, on touchstart, stash away the id of touch, then use this in touchmove and touchend to find your touch id in the array that is returned (in case the user has touched another finger later on). You can also simplify and check for multiple touches on touchmove and touchend and bail again there.c) I believe you need to call stopPropagation on touchstart, since you are handling the event. I don't see where they call event.preventDefault on the touchstart event You can see that this happens in the click handlers, but not the touchstart.There is also a simpler way. If you don't care about dragging starting on a button, then you can simply call your click logic in the touchstart event (and make sure you call event.preventDefault, TouchEvent.getTargetTouches() and check for single touch) and ignore touchmove and touchend. All the touchmove and touchend stuff is to handle the case of allowing dragging to start on the button.Ed
On Monday, November 5, 2012 5:29:53 AM UTC-8, markww wrote:Hi,I've got some buttons on a page which will primarily be used from mobile devices. The click handlers fire only after a 300ms delay (intentional on mobile devices as detailed here [https://developers.google.com/mobile/articles/fast_ ).buttons] Looks like someone has tried to implement the above for GWT:but I'm getting strange behavior from that FastButton implementation. Is there something baked into GWT 2.5 that does this for us?Thanks
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/m6WSLcwPpQkJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment