Skip to content

Commit

Permalink
Fix drag offsets passed to "drag.start" from touch drags in elproto.drag
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kswenson committed Aug 4, 2018
1 parent 527c51b commit ed3a7af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dev/raphael.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -3222,7 +3222,7 @@ define(["eve"], function(eve) {
onstart && eve.on("raphael.drag.start." + this.id, onstart);
onmove && eve.on("raphael.drag.move." + this.id, onmove);
onend && eve.on("raphael.drag.end." + this.id, onend);
eve("raphael.drag.start." + this.id, start_scope || move_scope || this, e.clientX + scrollX, e.clientY + scrollY, e);
eve("raphael.drag.start." + this.id, start_scope || move_scope || this, this._drag.x, this._drag.y, e);
}
this._drag = {};
draggable.push({el: this, start: start});
Expand Down

0 comments on commit ed3a7af

Please sign in to comment.