8000 DragElement: initialize clientX and clientY for touch events by jonfunkhouser · Pull Request #2997 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

DragElement: initialize clientX and clientY for touch events #2997

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

Merged
merged 3 commits into from
Sep 18, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
touch events: initialize clientX and clientY
this sets clientX and clientY to the values from the first touch in TouchEvent.changedTouches
  • Loading branch information
jonfunkhouser committed Sep 11, 2018
commit 20be404472b2310a7a05b29a7af2f2e8bfe63974
6 changes: 6 additions & 0 deletions src/components/dragelement/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ dragElement.init = function init(options) {
initialEvent = e;
rightClick = e.buttons === 2 || e.ctrlKey;

// fix Fx.hover for touch events
if(typeof e.clientX === 'undefined' && typeof e.clientY === 'undefined') {
e.clientX = startX;
e.clientY = startY;
}

newMouseDownTime = (new Date()).getTime();
if(newMouseDownTime - gd._mouseDownTime < DBLCLICKDELAY) {
// in a click train
Expand Down
0