com.google.gwt.event.dom.client.TouchMoveEvent Java Examples

The following examples show how to use com.google.gwt.event.dom.client.TouchMoveEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GanttWidget.java    From gantt with Apache License 2.0 6 votes vote down vote up
@Override
public void onTouchMove(TouchMoveEvent event) {
    if (event.getChangedTouches().length() == 1) {
        boolean preventDefaultAndReturn = false;
        // did we intend to scroll the container?
        // apply 'manual' vertical scrolling
        if (containerScrollStartPosY != -1) {
            container.setScrollTop(containerScrollStartPosY - event.getChangedTouches().get(0).getPageY());
            preventDefaultAndReturn = true;
        }
        if (containerScrollStartPosX != -1) {
            container.setScrollLeft(containerScrollStartPosX - event.getChangedTouches().get(0).getPageX());
            preventDefaultAndReturn = true;
        }
        if (preventDefaultAndReturn) {
            event.preventDefault();
            return;
        }

        if (GanttWidget.this.onTouchOrMouseMove(event.getNativeEvent())) {
            event.preventDefault();
        }
    }
}
 
Example #2
Source File: SvgArrowWidget.java    From gantt with Apache License 2.0 6 votes vote down vote up
protected void addMoveHandler() {
    if (msTouchSupported) {
        moveRegisteration = addDomHandler(pointerMoveHandler,
                PointerMoveEvent.getType());
        touchCancelRegisteration = addDomHandler(pointerCancelHandler,
                PointerCancelEvent.getType());
    } else if (touchSupported) {
        moveRegisteration = addDomHandler(touchMoveHandler,
                TouchMoveEvent.getType());
        touchCancelRegisteration = addDomHandler(touchCancelHandler,
                TouchCancelEvent.getType());
    } else {
        moveRegisteration = addDomHandler(mouseMoveHandler,
                MouseMoveEvent.getType());
    }
}
 
Example #3
Source File: DragSourceSupport.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
@Override
public void onTouchMove(TouchMoveEvent event) {
  Widget src = (Widget) event.getSource();
  Touch touch = event.getTargetTouches().get(0);
  com.google.gwt.dom.client.Element target = com.google.gwt.dom.client.Element.as(touch.getTarget());
  int x = touch.getRelativeX(target);
  int y = touch.getRelativeY(target);
  onMouseMove(src, x, y);
}
 
Example #4
Source File: PanListener.java    From djvu-html5 with GNU General Public License v2.0 5 votes vote down vote up
public PanListener(Widget widget) {
	this.widget = widget;
	widget.addDomHandler(this, MouseDownEvent.getType());
	widget.addDomHandler(this, MouseUpEvent.getType());
	widget.addDomHandler(this, MouseMoveEvent.getType());
	widget.addDomHandler(this, TouchStartEvent.getType());
	widget.addDomHandler(this, TouchEndEvent.getType());
	widget.addDomHandler(this, TouchMoveEvent.getType());
}
 
Example #5
Source File: PanListener.java    From djvu-html5 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onTouchMove(TouchMoveEvent event) {
	if (touchId == null)
		return;
	JsArray<Touch> touches = event.getTouches();
	for (int i = 0; i < touches.length(); i++) {
		Touch touch = touches.get(i);
		if (touch.getIdentifier() != touchId)
			continue;
		pan(touch.getClientX() - x, touch.getClientY() - y);
		x = touch.getClientX();
		y = touch.getClientY();
		event.preventDefault();
	}
}
 
Example #6
Source File: SvgArrowWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
@Override
public void onTouchMove(TouchMoveEvent event) {
    GWT.log("SvgArrowWidget.onTouchMove(TouchMoveEvent)");
    if (event.getChangedTouches().length() == 1) {
        handleMove(event.getNativeEvent());
        event.preventDefault();
    }
}
 
Example #7
Source File: HandlerPanel.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
public HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) {
  return addDomHandler(handler, TouchMoveEvent.getType());
}
 
Example #8
Source File: MockComponent.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
@Override
public final HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) {
  return handlers.addHandler(TouchMoveEvent.getType(), handler);
}
 
Example #9
Source File: AbstractInput.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) {
	return this.addDomHandler(handler, TouchMoveEvent.getType());
}
 
Example #10
Source File: ListItem.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) {
	return this.addDomHandler(handler, TouchMoveEvent.getType());
}
 
Example #11
Source File: Anchor.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) {
	return this.addDomHandler(handler, TouchMoveEvent.getType());
}
 
Example #12
Source File: GanttWidget.java    From gantt with Apache License 2.0 4 votes vote down vote up
/**
 * Reset listeners.
 */
public void resetListeners() {
    Event.sinkEvents(container, Event.ONSCROLL | Event.ONCONTEXTMENU);

    if (contextMenuHandlerRegistration == null) {
        contextMenuHandlerRegistration = addDomHandler(contextMenuHandler, ContextMenuEvent.getType());
    }

    if (scrollHandlerRegistration == null) {
        scrollHandlerRegistration = addHandler(scrollHandler, ScrollEvent.getType());
    }
    if (isMsTouchSupported()) {
        // IE10 pointer events (ms-prefixed events)
        if (pointerDownHandlerRegistration == null) {
            pointerDownHandlerRegistration = addDomHandler(msPointerDownHandler, PointerDownEvent.getType());
        }
        if (pointerUpHandlerRegistration == null) {
            pointerUpHandlerRegistration = addDomHandler(msPointerUpHandler, PointerUpEvent.getType());
        }
        if (pointerMoveHandlerRegistration == null) {
            pointerMoveHandlerRegistration = addDomHandler(msPointerMoveHandler, PointerMoveEvent.getType());
        }
        if (pointerCancelHandlerRegistration == null) {
            pointerCancelHandlerRegistration = addHandler(msPointerCancelHandler, PointerCancelEvent.getType());
        }
    } else if (touchSupported) {
        // touch events replaces mouse events
        if (touchStartHandlerRegistration == null) {
            touchStartHandlerRegistration = addDomHandler(touchStartHandler, TouchStartEvent.getType());
        }
        if (touchEndHandlerRegistration == null) {
            touchEndHandlerRegistration = addDomHandler(touchEndHandler, TouchEndEvent.getType());
        }
        if (touchMoveHandlerRegistration == null) {
            touchMoveHandlerRegistration = addDomHandler(touchMoveHandler, TouchMoveEvent.getType());
        }
        if (touchCancelHandlerRegistration == null) {
            touchCancelHandlerRegistration = addHandler(touchCancelHandler, TouchCancelEvent.getType());
        }

    } else {
        if (mouseDblClickHandlerRegistration == null) {
            mouseDblClickHandlerRegistration = addDomHandler(doubleClickHandler, DoubleClickEvent.getType());
        }
        if (mouseDownHandlerRegistration == null) {
            mouseDownHandlerRegistration = addDomHandler(mouseDownHandler, MouseDownEvent.getType());
        }
        if (mouseUpHandlerRegistration == null) {
            mouseUpHandlerRegistration = addDomHandler(mouseUpHandler, MouseUpEvent.getType());
        }
        if (isMovableSteps() || isResizableSteps()) {
            if (mouseMoveHandlerRegistration == null) {
                mouseMoveHandlerRegistration = addDomHandler(mouseMoveHandler, MouseMoveEvent.getType());
            }
        } else if (mouseMoveHandlerRegistration != null) {
            mouseMoveHandlerRegistration.removeHandler();
            mouseMoveHandlerRegistration = null;
        }
    }
}