@@ -26,6 +26,15 @@ dragElement.unhoverRaw = unhover.raw;
26
26
27
27
/**
28
28
* 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
+ *
29
38
* @param {object } options with keys:
30
39
* element (required) the DOM element to drag
31
40
* prepFn (optional) function(event, startX, startY)
@@ -44,10 +53,6 @@ dragElement.unhoverRaw = unhover.raw;
44
53
* numClicks is how many clicks we've registered within
45
54
* a doubleclick time
46
55
* 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
51
56
*/
52
57
dragElement . init = function init ( options ) {
53
58
var gd = options . gd ,
@@ -57,15 +62,11 @@ dragElement.init = function init(options) {
57
62
startY ,
58
63
newMouseDownTime ,
59
64
dragCover ,
60
- initialTarget ,
61
- initialOnMouseMove ;
65
+ initialTarget ;
62
66
63
67
if ( ! gd . _mouseDownTime ) gd . _mouseDownTime = 0 ;
64
68
65
69
function onStart ( e ) {
66
- // disable call to options.setCursor(evt)
67
- options . element . onmousemove = initialOnMouseMove ;
68
-
69
70
// make dragging and dragged into properties of gd
70
71
// so that others can look at and modify them
71
72
gd . _dragged = false ;
@@ -116,10 +117,6 @@ dragElement.init = function init(options) {
116
117
}
117
118
118
119
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
-
123
120
dragCover . onmousemove = null ;
124
121
dragCover . onmouseup = null ;
125
122
dragCover . onmouseout = null ;
@@ -166,10 +163,6 @@ dragElement.init = function init(options) {
166
163
return Lib . pauseEvent ( e ) ;
167
164
}
168
165
169
- // enable call to options.setCursor(evt)
170
- initialOnMouseMove = options . element . onmousemove ;
171
- if ( options . setCursor ) options . element . onmousemove = options . setCursor ;
172
-
173
166
options . element . onmousedown = onStart ;
174
167
options . element . style . pointerEvents = 'all' ;
175
168
} ;
0 commit comments