Fix drag offsets passed to "drag.start" from touch drags in elproto.drag #1101
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes a bug in which incorrect offsets were passed with touch drags. In
elproto.drag
,x
andy
are initialized toe.clientX
ande.clientY
respectively, but then there is code to update those values for touch events. Ultimately, the updatedx
andy
values are added toscrollX/scrollY
and then stored inthis._drag.x/this._drag.y
. The values passed along toeve("raphael.drag.start.", ...)
weree.clientX + scrollX/e.clientY + scrollY
which are the initial pre-corrected values. With this PR, the corrected valuesthis._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.