How to use the hammerjs.DIRECTION_UP function in hammerjs

To help you get started, we’ve selected a few hammerjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Workiva / wf-uicomponents / test / awesome_map / CustomSwipeGestureSpec.js View on Github external
it('should set direction to "up" when swiping up', function() {
                simulateSwipeGestureMoves(hammerInstance, { deltaY: 0 }, { deltaY: -2 });
                CustomSwipeGesture.handler(endEvent, hammerInstance);
                expect(endEvent.direction).toBe(Hammer.DIRECTION_UP);
            });
            it('should set direction to "down" when swiping down', function() {
github Workiva / wf-uicomponents / src / awesome_map / CustomSwipeGesture.js View on Github external
function getDirection() {
        var start = moves[0];
        var end = moves[moves.length - 1];
        var deltaX = Math.abs(end.deltaX - start.deltaX);
        var deltaY = Math.abs(end.deltaY - start.deltaY);
        if (deltaX >= deltaY) {
            return start.deltaX > end.deltaX ? Hammer.DIRECTION_LEFT : Hammer.DIRECTION_RIGHT;
        }
        return start.deltaY > end.deltaY ? Hammer.DIRECTION_UP : Hammer.DIRECTION_DOWN;
    }
github inkandswitch / capstone / src / components / Touch.tsx View on Github external
recognizers.push([
        Hammer.Swipe,
        {
          event: "threeFingerSwipeDown",
          pointers: 3,
          direction: Hammer.DIRECTION_DOWN,
        },
      ])
    }
    if (onThreeFingerSwipeUp) {
      recognizers.push([
        Hammer.Swipe,
        {
          event: "threeFingerSwipeUp",
          pointers: 3,
          direction: Hammer.DIRECTION_UP,
        },
      ])
    }

    this.hammer = new Hammer.Manager(this.ref, {
      recognizers,
    })
    this.hammer.on("pinchend", this.handle("onPinchEnd"))
    this.hammer.on("tap", this.handle("onTap"))
    this.hammer.on("doubletap", this.handle("onDoubleTap"))
    this.hammer.on(
      "threeFingerSwipeDown",
      this.handle("onThreeFingerSwipeDown"),
    )
    this.hammer.on("threeFingerSwipeUp", this.handle("onThreeFingerSwipeUp"))
  }
github inkandswitch / capstone / src / components / Touch.tsx View on Github external
recognizers.push([
        Hammer.Swipe,
        {
          event: "threeFingerSwipeDown",
          pointers: 1,
          direction: Hammer.DIRECTION_DOWN,
        },
      ])
    }
    if (onThreeFingerSwipeUp) {
      recognizers.push([
        Hammer.Swipe,
        {
          event: "threeFingerSwipeUp",
          pointers: 3,
          direction: Hammer.DIRECTION_UP,
        },
      ])
    }

    this.hammer = new Hammer.Manager(this.base, {
      recognizers,
    })
    this.hammer.on("pinchend", this.handle("onPinchEnd"))
    this.hammer.on("tap", this.handle("onTap"))
    this.hammer.on("doubletap", this.handle("onDoubleTap"))
    this.hammer.on(
      "threeFingerSwipeDown",
      this.handle("onThreeFingerSwipeDown"),
    )
    this.hammer.on("threeFingerSwipeUp", this.handle("onThreeFingerSwipeUp"))
  }
github software-mansion / react-native-gesture-handler / web / PanGestureHandler.js View on Github external
if (!isnan(minDist)) {
      return Hammer.DIRECTION_ALL;
    }

    if (!isnan(activeOffsetXStart))
      horizontalDirections.push(Hammer.DIRECTION_LEFT);
    if (!isnan(activeOffsetXEnd))
      horizontalDirections.push(Hammer.DIRECTION_RIGHT);
    if (horizontalDirections.length === 2)
      horizontalDirections = [Hammer.DIRECTION_HORIZONTAL];

    directions = directions.concat(horizontalDirections);
    let verticalDirections = [];

    if (!isnan(activeOffsetYStart))
      verticalDirections.push(Hammer.DIRECTION_UP);
    if (!isnan(activeOffsetYEnd))
      verticalDirections.push(Hammer.DIRECTION_DOWN);

    if (verticalDirections.length === 2)
      verticalDirections = [Hammer.DIRECTION_VERTICAL];

    directions = directions.concat(verticalDirections);

    if (!directions.length) {
      return Hammer.DIRECTION_NONE;
    }
    if (
      directions[0] === Hammer.DIRECTION_HORIZONTAL &&
      directions[1] === Hammer.DIRECTION_VERTICAL
    ) {
      return Hammer.DIRECTION_ALL;