Skip to content
This repository was archived by the owner on Jun 18, 2018. It is now read-only.

Commit ea3bcaf

Browse files
committed
Only rely on mousemove signaling end of drag in Firefox
Fixes #14, #19
1 parent 166057d commit ea3bcaf

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/HTML5Backend.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,21 @@ export default class HTML5Backend {
177177
this.currentNativeHandle = this.registry.addSource(type, this.currentNativeSource);
178178
this.actions.beginDrag([this.currentNativeHandle]);
179179

180-
// If mousemove fires, the drag is over but browser failed to tell us.
181-
window.addEventListener('mousemove', this.endDragNativeItem, true);
180+
// On Firefox, if mousemove fires, the drag is over but browser failed to tell us.
181+
// This is not true for other browsers.
182+
if (isFirefox()) {
183+
window.addEventListener('mousemove', this.endDragNativeItem, true);
184+
}
182185
}
183186

184187
endDragNativeItem() {
185188
if (!this.isDraggingNativeItem()) {
186189
return;
187190
}
188191

189-
window.removeEventListener('mousemove', this.endDragNativeItem, true);
192+
if (isFirefox()) {
193+
window.removeEventListener('mousemove', this.endDragNativeItem, true);
194+
}
190195

191196
this.actions.endDrag();
192197
this.registry.removeSource(this.currentNativeHandle);

0 commit comments

Comments
 (0)