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

Fix drag offsets passed to "drag.start" from touch drags in elproto.drag #1101

Conversation

kswenson
Copy link
Contributor

@kswenson kswenson commented Aug 4, 2018

Fixes a bug in which incorrect offsets were passed with touch drags. In elproto.drag, x and y are initialized to e.clientX and e.clientY respectively, but then there is code to update those values for touch events. Ultimately, the updated x and y values are added to scrollX/scrollY and then stored in this._drag.x/this._drag.y. The values passed along to eve("raphael.drag.start.", ...) were e.clientX + scrollX/e.clientY + scrollY which are the initial pre-corrected values. With this PR, the corrected values this._drag.x/this._drag.y are passed instead, which fixes the behavior for touch drags.

We ran into this in our application CODAP where we fixed it in our local embedded copy of Raphael in CODAP PR #223.

In `elproto.drag`, `x` and `y` are initialized to `e.clientX` and `e.clientY` respectively, but then there is code to update those values for touch events. Ultimately, the updated `x` and `y` values are added to `scrollX/scrollY` and then stored in `this._drag.x/this._drag.y`. The values passed along to `eve("raphael.drag.start.", ...)` were `e.clientX + scrollX/e.clientY + scrollY` which are the pre-corrected values. With this PR, the corrected values `this._drag.x/this._drag.y` are passed instead.
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

Successfully merging this pull request may close these issues.

None yet

2 participants