Skip to content

Commit 828110b

Browse files
committed
check for gd._dragging in onmouseout handle,
to not clear hoverdata before clicks
1 parent 40de0d2 commit 828110b

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

shelly/plotlyjs/static/plotlyjs/src/graph_interact.js

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -114,26 +114,30 @@ fx.init = function(gd) {
114114
// mousemove events for all data hover effects
115115
var maindrag = dragBox(gd, plotinfo, 0, 0,
116116
xa._length, ya._length,'ns','ew');
117-
$(maindrag)
118-
.mousemove(function(evt){
119-
fx.hover(gd,evt,subplot);
120-
fullLayout._lasthover = maindrag;
121-
fullLayout._hoversubplot = subplot;
122-
})
123-
.mouseout(function(evt) {
124-
/*
125-
* IMPORTANT:
126-
* We must check for the presence of the drag cover here.
127-
* If we don't, a 'mouseout' event is trigger on the
128-
* maindrag before each 'click' event, which has the effect
129-
* of cancelling the click event.
130-
*/
131-
if(fullLayout._dragCover) return;
132-
fx.unhover(gd, evt);
133-
})
134-
.click(function(evt) {
135-
fx.click(gd, evt);
136-
});
117+
118+
maindrag.onmousemove = function(evt) {
119+
fx.hover(gd, evt, subplot);
120+
fullLayout._lasthover = maindrag;
121+
fullLayout._hoversubplot = subplot;
122+
};
123+
124+
/*
125+
* IMPORTANT:
126+
* We must check for the presence of the drag cover here.
127+
* If we don't, a 'mouseout' event is trigger on the
128+
* maindrag before each 'click' event, which has the effect
129+
* of clearing the hoverdata; thus, cancelling the click event.
130+
*/
131+
maindrag.onmouseout = function(evt) {
132+
if(gd._dragging) return;
133+
134+
fx.unhover(gd, evt);
135+
};
136+
137+
maindrag.onclick = function(evt) {
138+
fx.click(gd, evt);
139+
};
140+
137141
// corner draggers
138142
dragBox(gd, plotinfo, -DRAGGERSIZE, -DRAGGERSIZE,
139143
DRAGGERSIZE, DRAGGERSIZE, 'n', 'w');
@@ -2070,7 +2074,6 @@ fx.dragElement = function(options) {
20702074
if(options.prepFn) options.prepFn(e, startX, startY);
20712075

20722076
dragCover = coverSlip();
2073-
gd._fullLayout._dragCover = dragCover;
20742077

20752078
dragCover.onmousemove = onMove;
20762079
dragCover.onmouseup = onDone;
@@ -2096,7 +2099,6 @@ fx.dragElement = function(options) {
20962099
dragCover.onmouseup = null;
20972100
dragCover.onmouseout = null;
20982101
Plotly.Lib.removeElement(dragCover);
2099-
delete gd._fullLayout._dragCover;
21002102

21012103
if(!gd._dragging) {
21022104
gd._dragged = false;

shelly/plotlyjs/static/plotlyjs/src/graph_obj.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1941,7 +1941,6 @@ plots.purge = function(gd) {
19411941

19421942
delete gd.fid;
19431943

1944-
19451944
delete gd.undoqueue; // action queue
19461945
delete gd.undonum;
19471946
delete gd.autoplay; // are we doing an action that doesn't go in undo queue?

0 commit comments

Comments
 (0)