mudcube / Event.js

:hand: Multi-touch, gestures, and other events—click, dblclick, dbltap, tap, longpress, drag, swipe, pinch, rotate, shake. For pointer events, each listener can handle anywhere from 1 to 12 fingers at a time, or more, depending on the device. Includes MetaKey tracking (CMD, CTRL) to support native key-commands in various platforms.
MIT License
368 stars 68 forks source link

Angle is supposed to be limited? #1

Closed pindamonhangaba closed 11 years ago

pindamonhangaba commented 11 years ago

All I get are these angles when swipping: 0, 90, 180, 270 Is this intentional?

mudcube commented 11 years ago

Yup, if you would like other angles you can set the "snap" attribute when calling "swipe". This would look like this:

Event.proxy.swipe({ snap: 45, listener: function() {}, target: targetElement, });

This would result in the angles being returned to be 0, 45, 90, 135, 180, and so on.

Change snap to 1 to get values 1, 2, 3, 4, 5, 6, 7 and so on.

Snap defines the degrees to "snap" to.

mudcube commented 11 years ago

You can also call like this:

Event.add(targetElement, "swipe", function() {}, { snap: 45 });

pindamonhangaba commented 11 years ago

Ahh, bootyfull!