8000 Cache the last mousemove event by rreusser · Pull Request #1304 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Cache the last mousemove event #1304

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 11 commits into from
Feb 15, 2017
Merged
Show file tree
Hide file tree
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
Prev Previous commit
Next Next commit
Rehover
  • Loading branch information
rreusser committed Jan 30, 2017
commit 5881ad5279319abaaa70fe780fe92dae2fa18006
12 changes: 6 additions & 6 deletions src/plots/cartesian/graph_interact.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,13 @@ fx.init = function(gd) {
var maindrag = dragBox(gd, plotinfo, 0, 0,
xa._length, ya._length, 'ns', 'ew');

gd._lastMoveEvt;
maindrag.onmousemove = function(evt) {
gd._lastMoveEvt = evt;
fx.hover(gd, evt, subplot);
// This is on `gd._fullLayout`, *not* fullLayout because the reference
// changes by the time this is called again.
gd._fullLayout._rehover = function() {
fx.hover(gd, evt, subplot);
};
gd._fullLayout._rehover();
fullLayout._lasthover = maindrag;
fullLayout._hoversubplot = subplot;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are this fx.hover and fullLayout._hoversubplot = subplot still necessary then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops! Good catch. I change this back and forth and accidentally left both. Fixed in the commit below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Yeah, you're right. There's still an extra item or two there. Fixing (and looking at the full diff when doing so this time)

};
Expand All @@ -132,13 +135,10 @@ fx.init = function(gd) {
maindrag.onmouseout = function(evt) {
if(gd._dragging) return;

gd._lastMoveEvt = null;

dragElement.unhover(gd, evt);
};

maindrag.onclick = function(evt) {
if(gd._lastMoveEvt) fx.hover(gd, gd._lastMoveEvt, subplot);
fx.click(gd, evt);
};

Expand Down
2 changes: 2 additions & 0 deletions src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -2026,4 +2026,6 @@ plots.doCalcdata = function(gd, traces) {

calcdata[i] = cd;
}

if(gd._fullLayout._rehover) gd._fullLayout._rehover();
};
0