This commit is contained in:
Eric Rowell
2013-04-02 22:29:56 -07:00
parent d0e984ca93
commit 22aaa15562
3 changed files with 47 additions and 7 deletions

View File

@@ -54,8 +54,35 @@ var Kinetic = {};
* @methodOf Kinetic.Global
*/
isDragging: function() {
var dd = Kinetic.DD;
return (!dd || dd.isDragging);
var dd = Kinetic.DD;
// if DD is not included with the build, then
// drag and drop is not even possible
if (!dd) {
return false;
}
// if DD is included with the build
else {
return dd.isDragging;
}
},
/**
* @method isDragReady returns whether or not a drag and drop operation is ready, but may
* not necessarily have started
* @methodOf Kinetic.Global
*/
isDragReady: function() {
var dd = Kinetic.DD;
// if DD is not included with the build, then
// drag and drop is not even possible
if (!dd) {
return false;
}
// if DD is included with the build
else {
return !!dd.node;
}
},
warn: function(str) {
/*

View File

@@ -412,10 +412,9 @@
},
_mousedown: function(evt) {
this._setPointerPosition(evt);
var dd = Kinetic.DD,
go = Kinetic.Global,
obj = this.getIntersection(this.getPointerPosition()),
shape;
var go = Kinetic.Global,
obj = this.getIntersection(this.getPointerPosition()),
shape;
if(obj && obj.shape) {
shape = obj.shape;
@@ -425,7 +424,7 @@
}
//init stage drag and drop
if(this.isDraggable() && !dd.node) {
if(this.isDraggable() && !go.isDragReady()) {
this.startDrag(evt);
}
},