Craig:

Tried your suggestion, apparently drawingPaper.*addDomHandler *and 
drawingPaper.*addHandler* are behaving identically. The first touch 
(equivalent to mouse button down), the first "touch move" (mouse move) and 
touch end (mouse button up) are working as expected. The subsequent touches 
and touch moves are unpredictable. It appears that once a touch event is 
handled (touch down or touch move or touch end) there appears to be a 
requirement to do a "cleanup". Though it's not clear what it is supposed to 
be. Any ideas? Please let me know.

Thank You
-Velu

On Monday, September 9, 2019 at 1:49:47 PM UTC-4, Velusamy Velu wrote:
>
> 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/86a08eab-51b0-47f5-ac6d-6120359e648a%40googlegroups.com.

Reply via email to