public ConsoleDisplay() { super(new AbsolutePanel(), CLASS_NAME); getElement().setId("consoleDisplayWrapper"); // Create display panel where screen is actually loaded display = new AbsolutePanel(); display.addStyleName("portrait"); display.getElement().setId("consoleDisplay"); // Add display to the wrapper ((AbsolutePanel)getWidget()).add(display, 0, 0); // Add move handlers which are only used on this display component if(BrowserUtils.isMobile) { this.addDomHandler(this, TouchMoveEvent.getType()); } else { this.addDomHandler(this, MouseMoveEvent.getType()); this.addDomHandler(this, MouseOutEvent.getType()); } }
@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(); } } }
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()); } }
@Override public List<HandlerRegistration> applyController(VectorObject shape, MapController mapController) { List<HandlerRegistration> registrations = new ArrayList<HandlerRegistration>(); registrations.add(shape.addMouseDownHandler(mapController)); registrations.add(shape.addMouseUpHandler(mapController)); registrations.add(shape.addMouseMoveHandler(mapController)); registrations.add(shape.addMouseOutHandler(mapController)); registrations.add(shape.addMouseOverHandler(mapController)); registrations.add(shape.addMouseWheelHandler(mapController)); registrations.add(shape.addDoubleClickHandler(mapController)); registrations.add(shape.addDomHandler(mapController, TouchStartEvent.getType())); registrations.add(shape.addDomHandler(mapController, TouchEndEvent.getType())); registrations.add(shape.addDomHandler(mapController, TouchMoveEvent.getType())); registrations.add(shape.addDomHandler(mapController, TouchCancelEvent.getType())); return registrations; }
@Override public HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) { return addDomHandler(handler, TouchMoveEvent.getType()); }
@Test public void shouldAddTouchMoveHandlerOnImage() { // given TouchOnImageMoveHandler touchOnImageMoveHandler = mock(TouchOnImageMoveHandler.class); TouchMoveHandlerOnImage touchMoveHandlerOnImage = mock(TouchMoveHandlerOnImage.class); when(touchHandlerFactory.createTouchMoveHandlerOnImage(touchOnImageMoveHandler)).thenReturn(touchMoveHandlerOnImage); // when testObj.addTouchOnImageMoveHandler(touchOnImageMoveHandler, listenOn); // then verify(listenOn).addDomHandler(touchMoveHandlerOnImage, TouchMoveEvent.getType()); }
@Test public void shouldAddTouchMoveHandler_ifNotIE() { // given TouchOnMoveHandler touchOnMoveHandler = mock(TouchOnMoveHandler.class); // when testObj.addTouchMoveHandler(touchOnMoveHandler, listenOn); // then verify(listenOn).addDomHandler(any(TouchMoveHandlerImpl.class), eq(TouchMoveEvent.getType())); }
@Override public void onTouchMove(TouchMoveEvent event) { event.preventDefault(); event.stopPropagation(); lastMoveEvent = new PressMoveEvent(event); ConsoleUnitEventManager.getInstance().getEventBus().fireEvent(lastMoveEvent); }
private static void initMobile() { // Prevent window scrolling RootPanel.get().addDomHandler(new TouchMoveHandler() { public void onTouchMove(TouchMoveEvent e) { e.preventDefault(); } }, TouchMoveEvent.getType()); Window.scrollTo(0, 1); new Timer() { public void run() { Window.scrollTo(0, 1); } }.schedule(1000); // Determine current window orientation if (getWindowHeight() < getWindowWidth()) { windowOrientation = "landscape"; } // Create a native orientation change handler as resize handler isn't reliable on iOS 3.x addNativeOrientationHandler(); // If Apple device then check if loaded from bookmark if (!isBookmarked()) { Window.alert("Please add this page to your Home Screen to view in fullscreen!"); } }
private void registerHandlers() { if(BrowserUtils.isMobile) { registerHandler(this.addDomHandler(this, TouchStartEvent.getType())); registerHandler(this.addDomHandler(this, TouchEndEvent.getType())); registerHandler(this.addDomHandler(this, TouchMoveEvent.getType())); } else { registerHandler(this.addDomHandler(this, MouseDownEvent.getType())); registerHandler(this.addDomHandler(this, MouseUpEvent.getType())); registerHandler(this.addDomHandler(this, MouseOutEvent.getType())); registerHandler(this.addDomHandler(this, MouseMoveEvent.getType())); } }
@Override public void onTouchMove(TouchMoveEvent event) { if (startEvent != null) { event.preventDefault(); event.stopPropagation(); propagateEvent(new PressMoveEvent(event)); } }
public void onTouchMove(TouchMoveEvent e) { // GWT.log("touchmove"); e.preventDefault(); Touch t = e.getTouches().get(0); doMouseMove(t.getRelativeX(getElement())); }
@Override public void onTouchMove(WebPlotView pv, ScreenPt spt, TouchMoveEvent ev) { if (_mouseDown) drag(pv, spt); }
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()); }
@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(); } }
@Override public void onTouchMove(TouchMoveEvent p_event) { Touch touch = getTouch(p_event.getChangedTouches(), m_currentTouchEventId); if (touch != null) { if (p_event.getTouches().length() < 2) { // A single finger touch shouldn't be propagated upwards. // This prevents iOS 'bounce-scroll' to happen p_event.preventDefault(); } onMove(Element.as(touch.getTarget()), touch.getClientX(), touch.getClientY()); } }
@Override public void onTouchMove(TouchMoveEvent event) { // final JsArray<Touch> targetTouches = event.getTargetTouches(); // button.setText("onTouchMove:" + event.getTouches().length() + ":" + event.getTargetTouches().length()); //// event.preventDefault(); // if (targetTouches.length() > 0) { // final EventTarget target = targetTouches.shift().getTarget(); // hasTargetTouch = target.equals(touchTarget); // button.setText(targetTouches.length() + ":" + hasTargetTouch); // } else { // touchTarget = null; // hasTargetTouch = true; // } }
@Override public void onTouchMove(TouchMoveEvent event) { GWT.log("SvgArrowWidget.onTouchMove(TouchMoveEvent)"); if (event.getChangedTouches().length() == 1) { handleMove(event.getNativeEvent()); event.preventDefault(); } }
public void onMapInitialized(MapInitializationEvent event) { VectorContainer container = mapPresenter.getContainerManager().addScreenContainer(); rectangle = new Rectangle(60, 40, 200, 80); rectangle.setFillColor("#CC9900"); rectangle.setFillOpacity(0.4); text = new Text(70, 60, "Drag me..."); text.setFontFamily("Arial"); text.setFontSize(16); text.setStrokeOpacity(0); text.setFillColor("#000000"); container.add(text); container.add(rectangle); DragHandler dragHandler = new DragHandler(); rectangle.addMouseDownHandler(dragHandler); rectangle.addMouseUpHandler(dragHandler); rectangle.addMouseMoveHandler(dragHandler); rectangle.addMouseOutHandler(dragHandler); rectangle.addDomHandler(dragHandler, TouchMoveEvent.getType()); rectangle.addDomHandler(dragHandler, TouchStartEvent.getType()); rectangle.addDomHandler(dragHandler, TouchEndEvent.getType()); text.addMouseDownHandler(dragHandler); text.addMouseUpHandler(dragHandler); text.addMouseMoveHandler(dragHandler); text.addMouseOutHandler(dragHandler); }
@Override public void onTouchMove(TouchMoveEvent event) { if (dragging) { if (event.getTouches().length() == 1) { Element e = event.getRelativeElement(); int deltaX = event.getTouches().get(0).getRelativeX(e) - startX; int deltaY = event.getTouches().get(0).getRelativeY(e) - startY; rectangle.setX(rectangle.getX() + deltaX); rectangle.setY(rectangle.getY() + deltaY); text.setX(text.getX() + deltaX); text.setY(text.getY() + deltaY); } } }
private void addMouseDownHandlers() { m_container.addDomHandler(this, MouseWheelEvent.getType()); m_container.addDomHandler(this, MouseOverEvent.getType()); m_container.addDomHandler(this, MouseOutEvent.getType()); m_container.addDomHandler(this, MouseMoveEvent.getType()); m_container.addDomHandler(this, MouseUpEvent.getType()); m_container.addDomHandler(this, MouseDownEvent.getType()); m_container.addDomHandler(this, TouchStartEvent.getType()); m_container.addDomHandler(this, TouchEndEvent.getType()); m_container.addDomHandler(this, TouchMoveEvent.getType()); }
@Override public void onTouchMove(TouchMoveEvent event) { s_logger.log(Level.INFO, "move"); Touch touch = event.getTouches().get(0); this.setMousePoint(touch.getRelativeX(m_container.getElement()), touch.getRelativeY(m_container.getElement()), m_mouseEvent.getPoint()); m_mouseEvent.set(E_MouseEventType.MOUSE_MOVE, 0, Element.as(event.getNativeEvent().getEventTarget()), true); dispatchEvent(m_mouseEvent); }
private void addHandlers() { addDomHandler(this, KeyUpEvent.getType()); if (TouchEvent.isSupported()) { addDomHandler(this, TouchStartEvent.getType()); addDomHandler(this, TouchMoveEvent.getType()); addDomHandler(this, TouchEndEvent.getType()); addDomHandler(this, TouchCancelEvent.getType()); } else { addDomHandler(this, MouseDownEvent.getType()); addDomHandler(this, MouseUpEvent.getType()); addDomHandler(this, MouseMoveEvent.getType()); } addDomHandler(this, FocusEvent.getType()); addDomHandler(this, BlurEvent.getType()); }
public void onTouchMove(TouchMoveEvent event) { if (isEnabled()) { Touch touch = event.getTouches().get(0).cast(); handleMouseMove(touch.getPageX(), touch.getPageY()); if (dragging) { event.preventDefault(); } } }
@Override public void onTouchMove(TouchMoveEvent event) { event.preventDefault(); touchOnImageMoveHandler.onMove(touchToImageEvent.getTouchOnImageEvent(event)); }
@Override public void addTouchOnImageMoveHandler(final TouchOnImageMoveHandler touchOnMoveHandler, Widget listenOn) { TouchMoveHandlerOnImage touchMoveHandlerOnImage = touchHandlerFactory.createTouchMoveHandlerOnImage(touchOnMoveHandler); listenOn.addDomHandler(touchMoveHandlerOnImage, TouchMoveEvent.getType()); }
@Override public void addTouchMoveHandler(final TouchOnMoveHandler touchOnMoveHandler, Widget listenOn) { listenOn.addDomHandler(new TouchMoveHandlerImpl(touchOnMoveHandler), TouchMoveEvent.getType()); }
@Override public void onTouchMove(TouchMoveEvent event) { touchOnMoveHandler.onMove(event.getNativeEvent()); }
public HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) { return addDomHandler(handler, TouchMoveEvent.getType()); }
@Override public void onTouchMove(WebPlotView pv, ScreenPt spt, TouchMoveEvent ev) { showMag(spt); }
@Override public void onTouchMove(WebPlotView pv, ScreenPt spt, TouchMoveEvent ev) { move(pv, spt, true, true); }
@Override public void onTouchMove(TouchMoveEvent p_event) { m_hasTouchMoved = true; }
@Override public com.google.gwt.event.shared.HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) { return this.addDomHandler(handler, TouchMoveEvent.getType()); }
@Override public HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) { return this.addDomHandler(handler, TouchMoveEvent.getType()); }