How to use the hammerjs.DIRECTION_DOWN 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 Financial-Times / x-dash / components / x-audio / src / components / SwipeableContainer.jsx View on Github external
listenForSwipeDown (swipeableElementRef) {

		if (swipeableElementRef === this.currentSwipeableElementRef) {
			// don't set hammer up for the same element more than once
			return;
		}

		this.hammer = new Hammer.Manager(swipeableElementRef);
		this.hammer.add(new Hammer.Pan({
			direction: Hammer.DIRECTION_DOWN,
			threshold: 0
		}) );

		this.hammer.on('pan', (ev) => {
			if (this.props.swipeEnabled) {
				handleSwipeDown(ev, this.props.onSwipeEnd, swipeableElementRef);
			}
		});

		this.currentSwipeableElementRef = swipeableElementRef;
	}
github Workiva / wf-uicomponents / test / awesome_map / CustomSwipeGestureSpec.js View on Github external
it('should set direction to "down" when swiping down', function() {
                simulateSwipeGestureMoves(hammerInstance, { deltaY: 0 }, { deltaY: 2 });
                CustomSwipeGesture.handler(endEvent, hammerInstance);
                expect(endEvent.direction).toBe(Hammer.DIRECTION_DOWN);
            });
            it('should use the dimension with the larger delta when determining direction', function() {
github Workiva / wf-uicomponents / test / awesome_map / CustomSwipeGestureSpec.js View on Github external
it('should use the dimension with the larger delta when determining direction', function() {
                simulateSwipeGestureMoves(hammerInstance,
                    { deltaX: 0, deltaY: 0 },
                    { deltaX: 2, deltaY: 4 }
                );
                CustomSwipeGesture.handler(endEvent, hammerInstance);
                expect(endEvent.direction).toBe(Hammer.DIRECTION_DOWN);
            });
        });
github software-mansion / react-native-gesture-handler / web / PanGestureHandler.js View on Github external
}

    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;
    }
    if (horizontalDirections.length && verticalDirections.length) {
github inkandswitch / capstone / src / components / Touch.tsx View on Github external
const recognizers: RecognizerTuple[] = []

    if (onPinchEnd) recognizers.push([Hammer.Pinch, { threshold: 0.5 }])
    if (onTap) recognizers.push([Hammer.Tap])
    if (onDoubleTap)
      recognizers.push([
        Hammer.Tap,
        { event: "doubletap", taps: 2, posThreshold: 40 },
      ])
    if (onThreeFingerSwipeDown) {
      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,
github YahooArchive / scrollable / examples / consumption / index.js View on Github external
componentDidMount: function() {
    this.refs.scroller.consuming = true;
    this.refs.scroller.origin = 0;
    var hammer = (this.hammer = new Hammer(this.refs.swipeArea.getDOMNode()));
    hammer.get('swipe').set({
      direction: Hammer.DIRECTION_DOWN,
      velocity: 0.3,
      threshold: 7,
    });
    hammer.on('swipe', this.swipeDown);
  },
github Financial-Times / x-dash / components / x-audio / src / redux / index.jsx View on Github external
listenForSwipeDown (expandedPlayerRef) {
			this.hammer = new Hammer.Manager(expandedPlayerRef);
			this.hammer.add(new Hammer.Pan({
				direction: Hammer.DIRECTION_DOWN,
				threshold: 0
			}) );
			this.hammer.on('pan', (ev) => {
				const onSwipeEnd = playerActions.onMinimise;
				handleSwipeDown(ev, onSwipeEnd, expandedPlayerRef);
			});

			this.expandedPlayerListensSwipe = expandedPlayerRef;
		}
github inkandswitch / capstone / src / components / Touch.tsx View on Github external
const recognizers: RecognizerTuple[] = []

    if (onPinchEnd) recognizers.push([Hammer.Pinch, { threshold: 0.5 }])
    if (onTap) recognizers.push([Hammer.Tap])
    if (onDoubleTap)
      recognizers.push([
        Hammer.Tap,
        { event: "doubletap", taps: 2, posThreshold: 40 },
      ])
    if (onThreeFingerSwipeDown) {
      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,