Craig:

I appreciate your suggestion. Behind the scene I'm handling multiple 
touches, though only one touch is being considered. The difference between 
your approach and mine is drawingPaper.*addDomHandler *and drawingPaper.
*addHandler*. I will give it a try and let you know.

Thank You
--v

On Monday, September 9, 2019 at 4:40:38 AM UTC-4, Craig Mitchell wrote:
>
> I found this as well.  I think browser implementation of these old single 
> touch events isn't great.  I switched to using the multi touch versions.  
> Something like this:
>
> private HashMap<Integer, Touch> touches;
>
> private void handleScreenTouches(JsArray<Touch> newTouches, boolean 
> touchDown) {
>   // Update the touch collection
>   for (int i=0; i<newTouches.length(); i++) {
>     Touch touch = newTouches.get(i);
>     if (touch != null) {
>       if (touchDown) {
>         touches.put(touch.getIdentifier(), touch);
>       }
>       else {
>         touches.remove(touch.getIdentifier());
>       }
>     }
>   }
>
>   // Look through the remaining touches
>   for (Touch touch : touches.values()) {
>     ...
>   }
> }
>
> drawingPaper.addDomHandler(event -> {
>     handleScreenTouches(event.getChangedTouches(), true);
> }, TouchStartEvent.getType()));
>
>
> drawingPaper.addDomHandler(event -> {
>     handleScreenTouches(event.getChangedTouches(), true);
> }, TouchMoveEvent.getType()));
>
>
> drawingPaper.addDomHandler(event -> {
>     handleScreenTouches(event.getChangedTouches(), false);
> }, TouchEndEvent.getType()));
>
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/50e9d8ea-bc1d-4183-81f8-e8ff7b2cfcf4%40googlegroups.com.

Reply via email to