How to use the hammerjs.EVENT_START 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 / src / awesome_map / CustomSwipeGesture.js View on Github external
handler: function swipeGesture(ev, inst) {
            // Enforce the max touches option.
            if (inst.options.swipe_max_touches > 0 &&
                ev.touches.length > inst.options.swipe_max_touches
            ) {
                this.cancel = true;
                return;
            }

            if (ev.eventType === Hammer.EVENT_START) {
                moves = [ev, ev];
            }
            else if (ev.eventType === Hammer.EVENT_MOVE) {
                moves.push(ev);
            }
            else if (ev.eventType === Hammer.EVENT_END) {
                // If canceling due to multitouch gesture, then bail out after
                // flipping the switch so the next swipe begins detection anew.
                if (this.cancel) {
                    this.cancel = false;
                    return;
                }

                // Calculate the velocity and direction using the last N moves
                // in an attempt to provide for a more "instantaneous" velocity.
                // By default, hammer calcs velocity and direction over the
github Workiva / wf-uicomponents / test / awesome_map / CustomSwipeGestureSpec.js View on Github external
function simulateSwipeGestureMoves(hammerInstance, move1Props, move2Props) {
            var startEvent = createFakeEvent({
                eventType: Hammer.EVENT_START
            });
            var moveEvent1 = createFakeEvent(_.defaults(move1Props, {
                eventType: Hammer.EVENT_MOVE,
                timeStamp: 1
            }));
            var moveEvent2 = createFakeEvent(_.defaults(move2Props, {
                eventType: Hammer.EVENT_MOVE,
                timeStamp: 2
            }));
            CustomSwipeGesture.handler(startEvent, hammerInstance);
            CustomSwipeGesture.handler(moveEvent1, hammerInstance);
            CustomSwipeGesture.handler(moveEvent2, hammerInstance);
        }
        var endEvent;