@@ -122,27 +122,18 @@ fx.init = function(gd) {
122
122
} )
123
123
. mouseout ( function ( evt ) {
124
124
/*
125
- * IMPORTANT: `fx.unhover(gd, evt)` has been commented out below
126
- * because in some browsers a 'mouseout' event is fired on clicks
127
- * on the maindrag container before reaching the 'click' handler.
128
- *
129
- * This results in a call to `fx.unhover` before `fx.click` where
130
- * `unhover` sets `gd._hoverdata` to `undefined` causing the call
131
- * to `fx.click` to return early.
132
- *
133
- * Note that the 'mouseout' handler is called only when the mouse
134
- * cursor gets lost. Most 'unhover' calls happen from 'mousemove';
135
- * these are not affected by the change below.
136
- *
137
- * Browsers where this behavior has been noticed:
138
- * - Chrome 46.0.2490.71
139
- * - Firefox 41.0.2
140
- * - IE 9, 10, 11
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.
141
130
*/
142
- // fx.unhover(gd, evt) ;
143
- return ;
131
+ if ( fullLayout . _dragCover ) return ;
132
+ fx . unhover ( gd , evt ) ;
144
133
} )
145
- . click ( function ( evt ) { fx . click ( gd , evt ) ; } ) ;
134
+ . click ( function ( evt ) {
135
+ fx . click ( gd , evt ) ;
136
+ } ) ;
146
137
// corner draggers
147
138
dragBox ( gd , plotinfo , - DRAGGERSIZE , - DRAGGERSIZE ,
148
139
DRAGGERSIZE , DRAGGERSIZE , 'n' , 'w' ) ;
@@ -2079,6 +2070,7 @@ fx.dragElement = function(options) {
2079
2070
if ( options . prepFn ) options . prepFn ( e , startX , startY ) ;
2080
2071
2081
2072
dragCover = coverSlip ( ) ;
2073
+ gd . _fullLayout . _dragCover = dragCover ;
2082
2074
2083
2075
dragCover . onmousemove = onMove ;
2084
2076
dragCover . onmouseup = onDone ;
@@ -2104,6 +2096,7 @@ fx.dragElement = function(options) {
2104
2096
dragCover . onmouseup = null ;
2105
2097
dragCover . onmouseout = null ;
2106
2098
Plotly . Lib . removeElement ( dragCover ) ;
2099
+ delete gd . _fullLayout . _dragCover ;
2107
2100
2108
2101
if ( ! gd . _dragging ) {
2109
2102
gd . _dragged = false ;
0 commit comments