diff --git a/lib/ace/mouse/dragdrop_handler.js b/lib/ace/mouse/dragdrop_handler.js index 41138bee..302538e1 100644 --- a/lib/ace/mouse/dragdrop_handler.js +++ b/lib/ace/mouse/dragdrop_handler.js @@ -286,19 +286,20 @@ function DragdropHandler(mouseHandler) { }; this.dragWaitEnd = function() { + var target = this.editor.container; + target.draggable = false; this.startSelect(this.mousedownEvent.getDocumentPosition()); this.selectEnd(); }; this.dragReadyEnd = function(e) { - var target = this.editor.container; - target.draggable = false; this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly()); this.editor.unsetStyle("ace_dragging"); this.dragWaitEnd(); }; this.startDrag = function(){ + this.cancelDrag = false; var target = this.editor.container; target.draggable = true; this.editor.renderer.$cursorLayer.setBlinking(false); @@ -307,17 +308,19 @@ function DragdropHandler(mouseHandler) { }; this.onMouseDrag = function(e) { + var target = this.editor.container; if (useragent.isIE && this.state == "dragReady") { // IE does not handle [draggable] attribute set after mousedown - var target = this.editor.container; var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y); if (distance > 3) target.dragDrop(); } if (this.state === "dragWait") { var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y); - if (distance > 0) + if (distance > 0) { + target.draggable = false; this.startSelect(this.mousedownEvent.getDocumentPosition()); + } } }; @@ -338,14 +341,9 @@ function DragdropHandler(mouseHandler) { if (editor.getDragDelay()) { // https://code.google.com/p/chromium/issues/detail?id=286700 if (useragent.isWebKit) { - var self = this; self.cancelDrag = true; var mouseTarget = editor.container; mouseTarget.draggable = true; - setTimeout(function(){ - self.cancelDrag = false; - mouseTarget.draggable = false; - }, 8); } this.setState("dragWait"); } else {