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() {
|
this.dragWaitEnd = function() {
|
||||||
|
var target = this.editor.container;
|
||||||
|
target.draggable = false;
|
||||||
this.startSelect(this.mousedownEvent.getDocumentPosition());
|
this.startSelect(this.mousedownEvent.getDocumentPosition());
|
||||||
this.selectEnd();
|
this.selectEnd();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.dragReadyEnd = function(e) {
|
this.dragReadyEnd = function(e) {
|
||||||
var target = this.editor.container;
|
|
||||||
target.draggable = false;
|
|
||||||
this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly());
|
this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly());
|
||||||
this.editor.unsetStyle("ace_dragging");
|
this.editor.unsetStyle("ace_dragging");
|
||||||
this.dragWaitEnd();
|
this.dragWaitEnd();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.startDrag = function(){
|
this.startDrag = function(){
|
||||||
|
this.cancelDrag = false;
|
||||||
var target = this.editor.container;
|
var target = this.editor.container;
|
||||||
target.draggable = true;
|
target.draggable = true;
|
||||||
this.editor.renderer.$cursorLayer.setBlinking(false);
|
this.editor.renderer.$cursorLayer.setBlinking(false);
|
||||||
|
|
@ -307,17 +308,19 @@ function DragdropHandler(mouseHandler) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onMouseDrag = function(e) {
|
this.onMouseDrag = function(e) {
|
||||||
|
var target = this.editor.container;
|
||||||
if (useragent.isIE && this.state == "dragReady") {
|
if (useragent.isIE && this.state == "dragReady") {
|
||||||
// IE does not handle [draggable] attribute set after mousedown
|
// 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);
|
var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
|
||||||
if (distance > 3)
|
if (distance > 3)
|
||||||
target.dragDrop();
|
target.dragDrop();
|
||||||
}
|
}
|
||||||
if (this.state === "dragWait") {
|
if (this.state === "dragWait") {
|
||||||
var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
|
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());
|
this.startSelect(this.mousedownEvent.getDocumentPosition());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -338,14 +341,9 @@ function DragdropHandler(mouseHandler) {
|
||||||
if (editor.getDragDelay()) {
|
if (editor.getDragDelay()) {
|
||||||
// https://code.google.com/p/chromium/issues/detail?id=286700
|
// https://code.google.com/p/chromium/issues/detail?id=286700
|
||||||
if (useragent.isWebKit) {
|
if (useragent.isWebKit) {
|
||||||
var self = this;
|
|
||||||
self.cancelDrag = true;
|
self.cancelDrag = true;
|
||||||
var mouseTarget = editor.container;
|
var mouseTarget = editor.container;
|
||||||
mouseTarget.draggable = true;
|
mouseTarget.draggable = true;
|
||||||
setTimeout(function(){
|
|
||||||
self.cancelDrag = false;
|
|
||||||
mouseTarget.draggable = false;
|
|
||||||
}, 8);
|
|
||||||
}
|
}
|
||||||
this.setState("dragWait");
|
this.setState("dragWait");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue