@@ -26,6 +26,15 @@ dragElement.unhoverRaw = unhover.raw;
2626
2727/**
2828 * Abstracts click & drag interactions
29+ *
30+ * During the interaction, a "coverSlip" element - a transparent
31+ * div covering the whole page - is created, which has two key effects:
32+ * - Lets you drag beyond the boundaries of the plot itself without
33+ * dropping (but if you drag all the way out of the browser window the
34+ * interaction will end)
35+ * - Freezes the cursor: whatever mouse cursor the drag element had when the
36+ * interaction started gets copied to the coverSlip for use until mouseup
37+ *
2938 * @param {object } options with keys:
3039 * element (required) the DOM element to drag
3140 * prepFn (optional) function(event, startX, startY)
@@ -44,10 +53,6 @@ dragElement.unhoverRaw = unhover.raw;
4453 * numClicks is how many clicks we've registered within
4554 * a doubleclick time
4655 * e is the original event
47- * setCursor (optional) function(event)
48- * executed on mousemove before mousedown
49- * the purpose of this callback is to update the mouse cursor before
50- * the click & drag interaction has been initiated
5156 */
5257dragElement . init = function init ( options ) {
5358 var gd = options . gd ,
@@ -57,15 +62,11 @@ dragElement.init = function init(options) {
5762 startY ,
5863 newMouseDownTime ,
5964 dragCover ,
60- initialTarget ,
61- initialOnMouseMove ;
65+ initialTarget ;
6266
6367 if ( ! gd . _mouseDownTime ) gd . _mouseDownTime = 0 ;
6468
6569 function onStart ( e ) {
66- // disable call to options.setCursor(evt)
67- options . element . onmousemove = initialOnMouseMove ;
68-
6970 // make dragging and dragged into properties of gd
7071 // so that others can look at and modify them
7172 gd . _dragged = false ;
@@ -116,10 +117,6 @@ dragElement.init = function init(options) {
116117 }
117118
118119 function onDone ( e ) {
119- // re-enable call to options.setCursor(evt)
120- initialOnMouseMove = options . element . onmousemove ;
121- if ( options . setCursor ) options . element . onmousemove = options . setCursor ;
122-
123120 dragCover . onmousemove = null ;
124121 dragCover . onmouseup = null ;
125122 dragCover . onmouseout = null ;
@@ -166,10 +163,6 @@ dragElement.init = function init(options) {
166163 return Lib . pauseEvent ( e ) ;
167164 }
168165
169- // enable call to options.setCursor(evt)
170- initialOnMouseMove = options . element . onmousemove ;
171- if ( options . setCursor ) options . element . onmousemove = options . setCursor ;
172-
173166 options . element . onmousedown = onStart ;
174167 options . element . style . pointerEvents = 'all' ;
175168} ;
0 commit comments