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

EndOffset event not working properly with SnapToGrid #114

Closed
NihilZer0 opened this issue Oct 12, 2018 · 2 comments
Closed

EndOffset event not working properly with SnapToGrid #114

NihilZer0 opened this issue Oct 12, 2018 · 2 comments

Comments

@NihilZer0
Copy link

Hello. I encountered a problem with EndOffset event of Draggable when using it along with SnapToGrid.

What I am doing is that on the EndOffset event I want to save the final position of the element so that I can initialize it in that exact position the next time that component is accessed. However, when combining it with the SnapToGrid feature it does not work as expected.

I noticed that the X and Y the event feeds me back are not the position of the element but the position of the cursor. So if you have the initial position { 0, 0 } and you move the cursor on the X axis for 20 pixels or so, it is not enough to trigger the snap so the element won't be moved but the saved position will be { 20, 0 }. The bigger the GridSize property, the bigger the errors.

Stackblitz with the problem reproduced : https://stackblitz.com/edit/angular-momucl

Any help with this would be appreciated. Thanks.

@xieziyu
Copy link
Owner

xieziyu commented Oct 15, 2018

@NihilZer0
Thanks for reporting this issue.
It's fixed in angular2-draggable@2.1.5

@NihilZer0
Copy link
Author

Thanks for the fix. =]

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

2 participants