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

Inertia effect to end pan #117

Closed
Seiifer opened this issue May 21, 2015 · 1 comment
Closed

Inertia effect to end pan #117

Seiifer opened this issue May 21, 2015 · 1 comment
Labels

Comments

@Seiifer
Copy link

Seiifer commented May 21, 2015

Hello,

I was thinking about adding the inertia effect when panning the SVG.
By Inertia effect I mean that after we are done panning, the pan continues for a few milliseconds at a slower (ideally decreasing) speed.
If you are wondering how it would look like, check on Google Map, they use this effect when panning.

I'm not quite sure how to achieve that.
Maybe if there were a afterPan function, but I don't really see how to get the speed of the mouse (unless we just check the time and the distance between the 2 clicks that triggered the pan.)
Or maybe by calling panBy after each pan but the direction of the pan is also needed.

@bumbu bumbu added the question label May 24, 2015
@bumbu
Copy link
Owner

bumbu commented May 24, 2015

Currently there is no such functionality and there is no plan for that.
It can be an idea for a plugin as per #98 but someone has to build that.

You could do that by listening for onPan callbacks, but it will not give you any information about when pan ended (as user may still hold the click even if he is not moving the mouse).
A solution would be to handle mouse events by yourself (as in [custom events](Custom events example)). There you'll have to compute by yourself velocity and direction of drag. After mouseup/touchend you'll have to call pan/panBy as long as you want your inertia to execute.

@bumbu bumbu closed this as completed May 24, 2015
@ariutta ariutta mentioned this issue Dec 28, 2015
34 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants