Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More sophisticated events for move/drag #107

Open
koenbok opened this issue Aug 18, 2014 · 9 comments
Open

More sophisticated events for move/drag #107

koenbok opened this issue Aug 18, 2014 · 9 comments

Comments

@koenbok
Copy link
Owner

koenbok commented Aug 18, 2014

https://www.facebook.com/groups/framerjs/permalink/547915885335487/

  • delta
  • angle
  • velocity
@koenbok
Copy link
Owner Author

koenbok commented Aug 18, 2014

One thing to think about is that I now calculate the velocity over the last 100 milliseconds for more precision. Not sure how to expose that onto an event. Maybe some property on the draggable?

https://github.com/koenbok/Framer/blob/master/framer/LayerDraggable.coffee#L56
https://github.com/koenbok/Framer/blob/master/framer/LayerDraggable.coffee#L26

@jordandobson
Copy link
Contributor

Here's some inspiration: http://hammerjs.github.io/api/#event-object

@jordandobson
Copy link
Contributor

^ From that list I typically use:

  • center
  • target
  • preventDefault
  • direction, offsetDirection
  • deltaX, deltaY, deltaTime
  • velocityX, velocityY, velocity
  • distance

@koenbok
Copy link
Owner Author

koenbok commented Aug 18, 2014

It's basically just a matter of calculating those and setting them on event here:
https://github.com/koenbok/Framer/blob/master/framer/LayerDraggable.coffee#L48

@tisho
Copy link
Contributor

tisho commented Aug 18, 2014

I'd add distance, too.

@jordandobson
Copy link
Contributor

Oops! Missed Distance... yes that too. Added it above.

@ThinkHap
Copy link

i need direction, drag x and drag y

@edwardsanchez
Copy link

How do I simulate press and hold? And then press+hold+drag?

@koenbok
Copy link
Owner Author

koenbok commented Sep 12, 2014

We should also sanitize events for mobile and desktop.

https://www.facebook.com/groups/framerjs/permalink/561406183986457/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants