mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 18:27:58 +08:00
drag and drop logic now works correctly on mobile when both the stage is draggable and a shape
This commit is contained in:
@@ -221,9 +221,6 @@
|
|||||||
*/
|
*/
|
||||||
Kinetic.Node.prototype.isDraggable = Kinetic.Node.prototype.getDraggable;
|
Kinetic.Node.prototype.isDraggable = Kinetic.Node.prototype.getDraggable;
|
||||||
|
|
||||||
// listen for capturing phase so that the _endDrag* methods are
|
|
||||||
// called before the stage mouseup event is triggered in order
|
|
||||||
// to render the hit graph just in time to pick up the event
|
|
||||||
var html = document.getElementsByTagName('html')[0];
|
var html = document.getElementsByTagName('html')[0];
|
||||||
html.addEventListener('mouseup', Kinetic.DD._endDragBefore, true);
|
html.addEventListener('mouseup', Kinetic.DD._endDragBefore, true);
|
||||||
html.addEventListener('touchend', Kinetic.DD._endDragBefore, true);
|
html.addEventListener('touchend', Kinetic.DD._endDragBefore, true);
|
||||||
|
@@ -462,12 +462,10 @@
|
|||||||
},
|
},
|
||||||
_touchstart: function(evt) {
|
_touchstart: function(evt) {
|
||||||
this._setPointerPosition(evt);
|
this._setPointerPosition(evt);
|
||||||
var dd = Kinetic.DD,
|
var go = Kinetic.Global,
|
||||||
go = Kinetic.Global,
|
|
||||||
obj = this.getIntersection(this.getPointerPosition()),
|
obj = this.getIntersection(this.getPointerPosition()),
|
||||||
shape;
|
shape;
|
||||||
|
|
||||||
|
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
|
||||||
if(obj && obj.shape) {
|
if(obj && obj.shape) {
|
||||||
@@ -477,8 +475,8 @@
|
|||||||
shape._handleEvent(TOUCHSTART, evt);
|
shape._handleEvent(TOUCHSTART, evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// init stage drag and drop
|
//init stage drag and drop
|
||||||
if(dd && !go.isDragging() && this.isDraggable()) {
|
if(this.isDraggable() && !go.isDragReady()) {
|
||||||
this.startDrag(evt);
|
this.startDrag(evt);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user