better dragging flow

This commit is contained in:
lavrton
2015-06-02 08:14:54 +07:00
parent e990e3c9e9
commit c2d9b1d436
12 changed files with 209 additions and 222 deletions

View File

@@ -223,4 +223,44 @@ afterEach(function(){
// });
});
init();
Konva.Stage.prototype.simulateMouseDown = function(pos) {
var top = this.content.getBoundingClientRect().top;
this._mousedown({
clientX: pos.x,
clientY: pos.y + top,
button: pos.button
});
};
Konva.Stage.prototype.simulateMouseMove = function(pos) {
var top = this.content.getBoundingClientRect().top;
var evt = {
clientX: pos.x,
clientY: pos.y + top,
button: pos.button
};
this._mousemove(evt);
Konva.DD._drag(evt);
};
Konva.Stage.prototype.simulateMouseUp = function(pos) {
"use strict";
var top = this.content.getBoundingClientRect().top;
var evt = {
clientX: pos.x,
clientY: pos.y + top,
button: pos.button
};
Konva.DD._endDragBefore(evt);
this._mouseup(evt);
Konva.DD._endDragAfter(evt);
}
init();