Workaround for #2166 is no longer required as of Firefox 57.0.2
This commit is contained in:
1 parent
4d8a6faac3
commit
d99d2581aa
1 file changed
-29
@@ -1124,12 +1124,10 @@ $(function() {
|
||||
if (enable) {
|
||||
$(document).bind("dragenter", self._handleDragEnter);
|
||||
$(document).bind("dragleave", self._handleDragLeave);
|
||||
$(document).bind("dragover", self._handleDragOver);
|
||||
log.debug("Enabled drag-n-drop");
|
||||
} else {
|
||||
$(document).unbind("dragenter", self._handleDragEnter);
|
||||
$(document).unbind("dragleave", self._handleDragLeave);
|
||||
$(document).unbind("dragover", self._handleDragOver);
|
||||
log.debug("Disabled drag-n-drop");
|
||||
}
|
||||
};
|
||||
@@ -1220,33 +1218,6 @@ $(function() {
|
||||
self._forceEndDragNDrop();
|
||||
};
|
||||
|
||||
self._handleDragOver = function(e) {
|
||||
// Workaround for Firefox
|
||||
//
|
||||
// Due to a browser bug (https://bugzilla.mozilla.org/show_bug.cgi?id=656164),
|
||||
// if you drag a file out of the window no drag leave event will be fired. So on Firefox we check if
|
||||
// our last dragover event was within a timeout. If not, we assume that's because the mouse
|
||||
// cursor left the browser window and force a drag stop.
|
||||
//
|
||||
// Since Firefox keeps on triggering dragover events even if the mouse is not moved while over the
|
||||
// browser window, this should work without side effects (e.g. the overlay should stay even if the user
|
||||
// keeps the mouse perfectly still).
|
||||
//
|
||||
// See #2166
|
||||
if (!OctoPrint.coreui.browser.firefox) return;
|
||||
if (e.target !== self._dragNDropTarget) return;
|
||||
|
||||
if (self._dragNDropFFTimeout !== undefined) {
|
||||
window.clearTimeout(self._dragNDropFFTimeout);
|
||||
self._dragNDropFFTimeout = undefined;
|
||||
}
|
||||
|
||||
self._dragNDropFFTimeout = window.setTimeout(function() {
|
||||
self._forceEndDragNDrop();
|
||||
self._dragNDropFFTimeout = undefined;
|
||||
}, self._dragNDropFFTimeoutDelay);
|
||||
};
|
||||
|
||||
self._handleDragEnter = function (e) {
|
||||
self.dropOverlay.addClass('in');
|
||||
|
||||
|
||||
Reference in new issue
Block a user