drag and drop logic now works correctly on mobile when both the stage is draggable and a shape

This commit is contained in:
Eric Rowell
2013-04-06 22:29:35 -07:00
parent 4610918f07
commit 9fd5df4d79
2 changed files with 3 additions and 8 deletions

View File

@@ -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);

View File

@@ -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);
} }
}, },