@@ -44,6 +44,10 @@ export default class MouseBackend {
44
44
this . handleWindowMoveCapture . bind ( this )
45
45
this . handleWindowMoveEndCapture =
46
46
this . handleWindowMoveEndCapture . bind ( this )
47
+ this . handleWindowClick =
48
+ this . handleWindowClick . bind ( this )
49
+ this . handleWindowDragstart =
50
+ this . handleWindowDragstart . bind ( this )
47
51
}
48
52
49
53
setup ( ) {
@@ -64,6 +68,10 @@ export default class MouseBackend {
64
68
this . handleWindowMoveCapture , true )
65
69
window . addEventListener ( 'mouseup' ,
66
70
this . handleWindowMoveEndCapture , true )
71
+ window . addEventListener ( 'click' ,
72
+ this . handleWindowClick , true )
73
+ window . addEventListener ( 'dragstart' ,
74
+ this . handleWindowDragstart , true )
67
75
}
68
76
69
77
getSourceClientOffset ( sourceId ) {
@@ -86,6 +94,10 @@ export default class MouseBackend {
86
94
'mousemove' , this . handleWindowMoveCapture , true )
87
95
window . removeEventListener (
88
96
'mouseup' , this . handleWindowMoveEndCapture , true )
97
+ window . removeEventListener (
98
+ 'click' , this . handleWindowClick , true )
99
+ window . removeEventListener (
100
+ 'dragstart' , this . handleWindowDragstart , true )
89
101
}
90
102
91
103
connectDragSource ( sourceId , node ) {
@@ -124,7 +136,9 @@ export default class MouseBackend {
124
136
this . moveStartSourceIds = [ ]
125
137
}
126
138
127
- handleMoveStart ( sourceId ) {
139
+ handleMoveStart ( sourceId , e ) {
140
+ // Ignore right mouse button.
141
+ if ( e . which === 3 ) return
128
142
this . moveStartSourceIds . unshift ( sourceId )
129
143
}
130
144
@@ -185,6 +199,7 @@ export default class MouseBackend {
185
199
this . moveStartSourceIds = null
186
200
return
187
201
}
202
+ this . preventClick = true
188
203
189
204
e . preventDefault ( )
190
205
@@ -195,6 +210,16 @@ export default class MouseBackend {
195
210
this . actions . endDrag ( )
196
211
}
197
212
213
+ handleWindowClick ( e ) {
214
+ if ( this . preventClick ) e . stopPropagation ( )
215
+ this . preventClick = false
216
+ }
217
+
218
+ // Disable drag on images (Firefox)
219
+ handleWindowDragstart ( e ) {
220
+ e . preventDefault ( )
221
+ }
222
+
198
223
installSourceNodeRemovalObserver ( node ) {
199
224
this . uninstallSourceNodeRemovalObserver ( )
200
225
0 commit comments