Friday, September 6, 2019

GWT Support for Touch Event

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.

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/15c87eb4-acec-4c78-8870-406cdc63a5f9%40googlegroups.com.

No comments:

Post a Comment