@@ -114,35 +114,30 @@ fx.init = function(gd) {
114
114
// mousemove events for all data hover effects
115
115
var maindrag = dragBox ( gd , plotinfo , 0 , 0 ,
116
116
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: `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
141
- */
142
- // fx.unhover(gd, evt);
143
- return ;
144
- } )
145
- . click ( function ( evt ) { fx . click ( gd , evt ) ; } ) ;
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 triggered 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
+
146
141
// corner draggers
147
142
dragBox ( gd , plotinfo , - DRAGGERSIZE , - DRAGGERSIZE ,
148
143
DRAGGERSIZE , DRAGGERSIZE , 'n' , 'w' ) ;
0 commit comments