I'm implementing an online drawing tool using GWT & HTML5. I have handled mouse events successfully and I'm venturing in to handling touch events to cover devices that only fire touch events. I have tried
com.google.gwt.event.dom.client.Touch*Events.
I do notice TouchStart, TouchMove, & TouchEnd events being fired. However, when these events utilized (start drawing, continue drawing, finish drawing; for e.g., a line) handling events become inconsistent. TouchStart is always handled well but the other two, TouchMove and TouchEnd aren't handled consistently. Given below is a segment of code.
drawingPaper.sinkEvents(Event.TOUCHEVENTS);
// Handle touch start
drawingPaper.addHandler(new TouchStartHandler() {
@Override
public void onTouchStart(TouchStartEvent event) {
startingPoint = PointerEventHelper.getUsableLocation(event, ...);
// no device specific code in the method below
handlePointerDownActionImpl(); /* Consistently getting called */
}
}, TouchStartEvent.getType());
// Handle touch move
drawingPaper.addHandler(new TouchMoveHandler() {
@Override
public void onTouchMove(TouchMoveEvent event) {
currentLocation = PointerEventHelper.getUsableLocation(event, ...);
// no device specific code in the method below
handlePointerMoveActionImpl(); /* Call to this is inconsistent */
}
}, TouchMoveEvent.getType());
I'm using browsers like Chrome, Firefox, Duck Duck Go, Bravo, Opera, and Opera Mini on my Pixel 2 and Samsung Galaxy Tab A.
Any suggestions would be very much appreciated.