Examples of Touch


Examples of com.google.gwt.dom.client.Touch

                }
                /*
                 * TODO calculate based on real distance instead of separate
                 * axis checks
                 */
                Touch touch = event.getChangedTouches().get(0);
                if (Math.abs(touch.getClientX() - touchStartX) > TouchScrollDelegate.SIGNIFICANT_MOVE_THRESHOLD) {
                    return true;
                }
                if (Math.abs(touch.getClientY() - touchStartY) > TouchScrollDelegate.SIGNIFICANT_MOVE_THRESHOLD) {
                    return true;
                }
                return false;
            }
View Full Code Here

Examples of com.google.gwt.dom.client.Touch

    if (e.getType().equals("touchstart")) {
      this.justTouched = true;
      JsArray<Touch> touches = e.getChangedTouches();
      for (int i = 0, j = touches.length(); i < j; i++) {
        Touch touch = touches.get(i);
        int touchId = touch.getIdentifier();
        touched[touchId] = true;
        touchX[touchId] = touch.getRelativeX(canvas);
        touchY[touchId] = touch.getRelativeY(canvas);
        deltaX[touchId] = 0;
        deltaY[touchId] = 0;
        if (processor != null) {
          processor.touchDown(touchX[touchId], touchY[touchId], touchId, Buttons.LEFT);
        }       
      }
      this.currentEventTimeStamp = TimeUtils.nanoTime();
      e.preventDefault();
    }
    if (e.getType().equals("touchmove")) {
      JsArray<Touch> touches = e.getChangedTouches();
      for (int i = 0, j = touches.length(); i < j; i++) {
        Touch touch = touches.get(i);
        int touchId = touch.getIdentifier();
        deltaX[touchId] = touch.getRelativeX(canvas) - touchX[touchId];
        deltaY[touchId] = touch.getRelativeY(canvas) - touchY[touchId];
        touchX[touchId] = touch.getRelativeX(canvas);
        touchY[touchId] = touch.getRelativeY(canvas);
        if (processor != null) {
          processor.touchDragged(touchX[touchId], touchY[touchId], touchId);
        }
      }
      this.currentEventTimeStamp = TimeUtils.nanoTime();
      e.preventDefault();
    }
    if (e.getType().equals("touchcancel")) {
      JsArray<Touch> touches = e.getChangedTouches();
      for (int i = 0, j = touches.length(); i < j; i++) {
        Touch touch = touches.get(i);
        int touchId = touch.getIdentifier();
        touched[touchId] = false;
        deltaX[touchId] = touch.getRelativeX(canvas) - touchX[touchId];
        deltaY[touchId] = touch.getRelativeY(canvas) - touchY[touchId];       
        touchX[touchId] = touch.getRelativeX(canvas);
        touchY[touchId] = touch.getRelativeY(canvas);
        if (processor != null) {
          processor.touchUp(touchX[touchId], touchY[touchId], touchId, Buttons.LEFT);
        }         
      }
      this.currentEventTimeStamp = TimeUtils.nanoTime();
      e.preventDefault();
    }
    if (e.getType().equals("touchend")) {     
      JsArray<Touch> touches = e.getChangedTouches();
      for (int i = 0, j = touches.length(); i < j; i++) {
        Touch touch = touches.get(i);
        int touchId = touch.getIdentifier();
        touched[touchId] = false;
        deltaX[touchId] = touch.getRelativeX(canvas) - touchX[touchId];
        deltaY[touchId] = touch.getRelativeY(canvas) - touchY[touchId];       
        touchX[touchId] = touch.getRelativeX(canvas);
        touchY[touchId] = touch.getRelativeY(canvas);
        if (processor != null) {
          processor.touchUp(touchX[touchId], touchY[touchId], touchId, Buttons.LEFT);
        }         
      }
      this.currentEventTimeStamp = TimeUtils.nanoTime();
View Full Code Here

Examples of com.google.gwt.dom.client.Touch

      if (isReadOnly()) {
        return;
      }
      event.stopPropagation();
      event.preventDefault();
      Touch touch = event.getTouches().get(0);
      now_x = touch.getClientX();
      if (!moved) {
        if (Math.abs(now_x - x_start) < appearance.css().DRAG_DEADZONE()) {
          return;
        }
      }
View Full Code Here

Examples of com.google.gwt.dom.client.Touch

      event.preventDefault();
      if (MGWT.getFormFactor().isDesktop()) {
        DOM.setCapture(getElement());
      }

      Touch touch = event.getTouches().get(0);
      x_start = touch.getClientX();
      moved = false;
      if (value) {
        x_min = appearance.css().CONTAINER_MIN_ON();
        x_max = appearance.css().CONTAINER_MAX_ON();
        offset = appearance.css().CONTAINER_OFFSET_ON();
View Full Code Here

Examples of com.google.gwt.dom.client.Touch

        if (!isEnabled())
          return;

        if (ignore)
          return;
        Touch touch = event.getTouches().get(0);
        last_x = touch.getPageX();
        last_y = touch.getPageY();

      }

      @Override
      public void onTouchStart(TouchStartEvent event) {
        if (!isEnabled())
          return;
        ignore = inputRadio.isChecked();

        if (ignore)
          return;

        Touch touch = event.getTouches().get(0);
        start_x = touch.getPageX();
        start_y = touch.getPageY();
        last_x = start_x;
        last_y = start_y;

        EventTarget eventTarget = event.getNativeEvent().getEventTarget();
        labelOrContainer = true;
View Full Code Here

Examples of com.google.gwt.dom.client.Touch

    }

    @Override
    public void onTouchMove(TouchMoveEvent event) {
      Touch touch = event.getTouches().get(0);
      if (Math.abs(touch.getPageX() - x) > Tap.RADIUS
          || Math.abs(touch.getPageY() - y) > Tap.RADIUS) {
        moved = true;
        // deselect
        if (node != null) {
          node.removeClassName(CellList.this.appearance.css().selected());
          stopTimer();
View Full Code Here

Examples of com.google.gwt.dom.client.Touch

        return isTouchEvent(Event.as(event));
    }

    public static void simulateClickFromTouchEvent(Event touchevent,
            Widget widget) {
        Touch touch = touchevent.getChangedTouches().get(0);
        final NativeEvent createMouseUpEvent = Document.get()
                .createMouseUpEvent(0, touch.getScreenX(), touch.getScreenY(),
                        touch.getClientX(), touch.getClientY(), false, false,
                        false, false, NativeEvent.BUTTON_LEFT);
        final NativeEvent createMouseDownEvent = Document.get()
                .createMouseDownEvent(0, touch.getScreenX(),
                        touch.getScreenY(), touch.getClientX(),
                        touch.getClientY(), false, false, false, false,
                        NativeEvent.BUTTON_LEFT);
        final NativeEvent createMouseClickEvent = Document.get()
                .createClickEvent(0, touch.getScreenX(), touch.getScreenY(),
                        touch.getClientX(), touch.getClientY(), false, false,
                        false, false);

        /*
         * Get target with element from point as we want the actual element, not
         * the one that sunk the event.
         */
        final Element target = getElementFromPoint(touch.getClientX(),
                touch.getClientY());
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {
            public void execute() {
                try {
                    target.dispatchEvent(createMouseDownEvent);
                    target.dispatchEvent(createMouseUpEvent);
View Full Code Here

Examples of com.google.gwt.dom.client.Touch

    }

    public void onTouchStart(TouchStartEvent event) {
        if (activeScrollDelegate == null && event.getTouches().length() == 1) {

            Touch touch = event.getTouches().get(0);
            if (detectScrolledElement(touch)) {
                VConsole.log("TouchDelegate takes over");
                event.stopPropagation();
                handlerRegistration = Event.addNativePreviewHandler(this);
                activeScrollDelegate = this;
                hookTransitionEndListener(scrolledElement
                        .getFirstChildElement());
                origX = touch.getClientX();
                origY = touch.getClientY();
                yPositions[0] = origY;
                eventTimeStamps[0] = new Date();
                nextEvent = 1;

                if (transitionOn) {
View Full Code Here

Examples of com.google.gwt.dom.client.Touch

     * @param event
     * @return
     */
    private boolean readPositionAndSpeed(NativeEvent event) {
        Date now = new Date();
        Touch touch = event.getChangedTouches().get(0);
        lastClientY = touch.getClientY();
        int eventIndx = nextEvent++;
        eventIndx = eventIndx % EVENTS_FOR_SPEED_CALC;
        eventTimeStamps[eventIndx] = now;
        yPositions[eventIndx] = lastClientY;
        return isMovedSignificantly();
View Full Code Here

Examples of com.google.gwt.dom.client.Touch

                        }

                        break;
                    case Event.ONTOUCHSTART:
                        touchStart = event;
                        Touch touch = event.getChangedTouches().get(0);
                        // save position to fields, touches in events are same
                        // isntance during the operation.
                        touchStartX = touch.getClientX();
                        touchStartY = touch.getClientY();
                        /*
                         * Prevent simulated mouse events.
                         */
                        touchStart.preventDefault();
                        if (dragmode != 0 || actionKeys != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.