@@ -121,27 +121,18 @@ fx.init = function(gd) {
121
121
} )
122
122
. mouseout ( function ( evt ) {
123
123
/*
124
- * IMPORTANT: `fx.unhover(gd, evt)` has been commented out below
125
- * because in some browsers a 'mouseout' event is fired on clicks
126
- * on the maindrag container before reaching the 'click' handler.
127
- *
128
- * This results in a call to `fx.unhover` before `fx.click` where
129
- * `unhover` sets `gd._hoverdata` to `undefined` causing the call
130
- * to `fx.click` to return early.
131
- *
132
- * Note that the 'mouseout' handler is called only when the mouse
133
- * cursor gets lost. Most 'unhover' calls happen from 'mousemove';
134
- * these are not affected by the change below.
135
- *
136
- * Browsers where this behavior has been noticed:
137
- * - Chrome 46.0.2490.71
138
- * - Firefox 41.0.2
139
- * - IE 9, 10, 11
124
+ * IMPORTANT:
125
+ * We must check for the presence of the drag cover here.
126
+ * If we don't, a 'mouseout' event is trigger on the
127
+ * maindrag before each 'click' event, which has the effect
128
+ * of cancelling the click event.
140
129
*/
141
- // fx.unhover(gd, evt) ;
142
- return ;
130
+ if ( fullLayout . _dragCover ) return ;
131
+ fx . unhover ( gd , evt ) ;
143
132
} )
144
- . click ( function ( evt ) { fx . click ( gd , evt ) ; } ) ;
133
+ . click ( function ( evt ) {
134
+ fx . click ( gd , evt ) ;
135
+ } ) ;
145
136
// corner draggers
146
137
dragBox ( gd , plotinfo , - DRAGGERSIZE , - DRAGGERSIZE ,
147
138
DRAGGERSIZE , DRAGGERSIZE , 'n' , 'w' ) ;
@@ -2074,6 +2065,7 @@ fx.dragElement = function(options) {
2074
2065
if ( options . prepFn ) options . prepFn ( e , startX , startY ) ;
2075
2066
2076
2067
dragCover = coverSlip ( ) ;
2068
+ gd . _fullLayout . _dragCover = dragCover ;
2077
2069
2078
2070
dragCover . onmousemove = onMove ;
2079
2071
dragCover . onmouseup = onDone ;
@@ -2099,6 +2091,7 @@ fx.dragElement = function(options) {
2099
2091
dragCover . onmouseup = null ;
2100
2092
dragCover . onmouseout = null ;
2101
2093
Plotly . Lib . removeElement ( dragCover ) ;
2094
+ delete gd . _fullLayout . _dragCover ;
2102
2095
2103
2096
if ( ! gd . _dragging ) {
2104
2097
gd . _dragged = false ;
0 commit comments