Fix webkit fake mousemove event (breaking dnd) issue
This commit is contained in:
parent
b1ba675cfd
commit
ad4e57e600
1 changed files with 7 additions and 9 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue