Package com.google.gwt.dom.client

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


            case Event.ONTOUCHSTART:
                // save position to fields, touches in events are same
                // instance during the operation.
                touchStart = event;

                Touch touch = event.getChangedTouches().get(0);
                touchStartX = touch.getClientX();
                touchStartY = touch.getClientY();

                if (contextTouchTimeout == null) {
                    contextTouchTimeout = new Timer() {

                        @Override
View Full Code Here


                return false;
            }

            // Calculate the distance between touch start and the current touch
            // position
            Touch touch = event.getChangedTouches().get(0);
            int deltaX = touch.getClientX() - touchStartX;
            int deltaY = touch.getClientY() - touchStartY;
            int delta = deltaX * deltaX + deltaY * deltaY;

            // Compare to the square of the significant move threshold to remove
            // the need for a square root
            if (delta > TouchScrollDelegate.SIGNIFICANT_MOVE_THRESHOLD
View Full Code Here

    private void doTouchStart(NativeEvent nativeEvent) {
        if (transitionOn) {
            momentum.cancel();
        }
        Touch touch = nativeEvent.getTouches().get(0);
        if (detectScrolledElement(touch)) {
            VConsole.log("TouchDelegate takes over");
            nativeEvent.stopPropagation();
            handlerRegistration = Event.addNativePreviewHandler(this);
            activeScrollDelegate = this;
            origY = touch.getClientY();
            yPositions[0] = origY;
            eventTimeStamps[0] = getTimeStamp();
            nextEvent = 1;

            origScrollTop = getScrollTop();
View Full Code Here

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

        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());

        /*
         * Fixes infocusable form fields in Safari of iOS 5.x and some Android
         * browsers.
         */
 
View Full Code Here

                    switch (type) {
                    case Event.ONTOUCHSTART:
                        touchEventHandled = true;
                        touchStart = event;
                        isDragging = false;
                        Touch touch = event.getChangedTouches().get(0);
                        // save position to fields, touches in events are same
                        // instance during the operation.
                        touchStartX = touch.getClientX();
                        touchStartY = touch.getClientY();

                        if (dragmode != 0) {
                            if (dragTouchTimeout == null) {
                                dragTouchTimeout = new Timer() {
View Full Code Here

                        }

                        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

                }
                /*
                 * 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

      canvas.addTouchStartHandler(new TouchStartHandler() {
    @Override
    public void onTouchStart(TouchStartEvent event) {
            event.preventDefault();
            if (event.getTouches().length() > 0) {
              Touch touch = event.getTouches().get(0);
              mouseStartX = touch.getRelativeX(canvas.getElement());
              mouseStartY = touch.getRelativeY(canvas.getElement());
              //garden.draw(mouseX,mouseY);
            }
            event.preventDefault();
     
    }
View Full Code Here

    start_y = event.getTouches().get(0).getPageY();
  }

  @Override
  public void onTouchMove(TouchMoveEvent event) {
    Touch touch = event.getTouches().get(0);
    if (Math.abs(touch.getPageX() - start_x) > distance || Math.abs(touch.getPageY() - start_y) > distance) {
      hasMoved = true;
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.dom.client.Touch

Copyright © 2018 www.massapicom. 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.