fix drag&drop on mobile

This commit is contained in:
Anton Lavrenov
2019-02-27 09:14:07 -05:00
parent a62ce96214
commit 0d9a27f185
7 changed files with 1412 additions and 53 deletions

View File

@@ -283,4 +283,50 @@ Konva.Stage.prototype.simulateMouseUp = function(pos) {
Konva.DD._endDragAfter(evt);
};
Konva.Stage.prototype.simulateTouchStart = function(pos) {
var top = this.content.getBoundingClientRect().top;
this._touchstart({
touches: [
{
clientX: pos.x,
clientY: pos.y + top
}
]
});
};
Konva.Stage.prototype.simulateTouchMove = function(pos) {
var top = this.content.getBoundingClientRect().top;
var evt = {
touches: [
{
clientX: pos.x,
clientY: pos.y + top
}
]
};
this._touchmove(evt);
Konva.DD._drag(evt);
};
Konva.Stage.prototype.simulateTouchEnd = function(pos) {
var top = this.content.getBoundingClientRect().top;
var evt = {
touches: [
{
clientX: pos.x,
clientY: pos.y + top
}
]
};
Konva.DD._endDragBefore(evt);
this._touchend(evt);
Konva.DD._endDragAfter(evt);
};
init();