1111
1212var mouseOffset = require ( 'mouse-event-offset' ) ;
1313var hasHover = require ( 'has-hover' ) ;
14+ var supportsPassive = require ( 'has-passive-events' ) ;
1415
1516var Plotly = require ( '../../plotly' ) ;
1617var Lib = require ( '../../lib' ) ;
@@ -27,7 +28,6 @@ var unhover = require('./unhover');
2728dragElement . unhover = unhover . wrapped ;
2829dragElement . unhoverRaw = unhover . raw ;
2930
30- var supportsPassive = Lib . eventListenerOptionsSupported ( ) ;
3131
3232/**
3333 * Abstracts click & drag interactions
@@ -124,6 +124,8 @@ dragElement.init = function init(options) {
124124 var clampFn = options . clampFn || _clampFn ;
125125
126126 function onStart ( e ) {
127+ e . preventDefault ( ) ;
128+
127129 // make dragging and dragged into properties of gd
128130 // so that others can look at and modify them
129131 gd . _dragged = false ;
@@ -164,10 +166,12 @@ dragElement.init = function init(options) {
164166 document . addEventListener ( 'touchmove' , onMove ) ;
165167 document . addEventListener ( 'touchend' , onDone ) ;
166168
167- return Lib . pauseEvent ( e ) ;
169+ return ;
168170 }
169171
170172 function onMove ( e ) {
173+ e . preventDefault ( ) ;
174+
171175 var offset = pointerOffset ( e ) ;
172176 var minDrag = options . minDrag || constants . MINDRAG ;
173177 var dxdy = clampFn ( offset [ 0 ] - startX , offset [ 1 ] - startY , minDrag ) ;
@@ -181,7 +185,7 @@ dragElement.init = function init(options) {
181185
182186 if ( gd . _dragged && options . moveFn && ! rightClick ) options . moveFn ( dx , dy ) ;
183187
184- return Lib . pauseEvent ( e ) ;
188+ return ;
185189 }
186190
187191 function onDone ( e ) {
@@ -190,6 +194,8 @@ dragElement.init = function init(options) {
190194 document . removeEventListener ( 'touchmove' , onMove ) ;
191195 document . removeEventListener ( 'touchend' , onDone ) ;
192196
197+ e . preventDefault ( ) ;
198+
193199 if ( hasHover ) {
194200 Lib . removeElement ( dragCover ) ;
195201 }
@@ -246,7 +252,7 @@ dragElement.init = function init(options) {
246252
247253 gd . _dragged = false ;
248254
249- return Lib . pauseEvent ( e ) ;
255+ return ;
250256 }
251257} ;
252258
0 commit comments