caching mechanism no longer auto adjusts offsets. It causes too many side effects

This commit is contained in:
Eric Rowell
2013-12-30 14:34:57 -08:00
parent a47726eb2f
commit e1558c1b40
2 changed files with 22 additions and 17 deletions

View File

@@ -146,6 +146,8 @@
x: x,
y: y
};
return this;
},
/*
* the default isDraggable method returns false.
@@ -601,12 +603,11 @@
getAbsolutePosition: function() {
var absoluteMatrix = this.getAbsoluteTransform().getMatrix(),
absoluteTransform = new Kinetic.Transform(),
o = this.getOffset();
offset = this.offset();
// clone the matrix array
absoluteTransform.m = absoluteMatrix.slice();
absoluteTransform.translate(o.x, o.y);
absoluteTransform.translate(offset.x, offset.y);
return absoluteTransform.getTranslation();
},
@@ -1012,7 +1013,6 @@
},
_getTransform: function() {
var m = new Kinetic.Transform(),
cachedCanvas = this._cache.canvas,
x = this.getX(),
y = this.getY(),
rotation = this.getRotation(),
@@ -1023,16 +1023,6 @@
offsetX = this.getOffsetX(),
offsetY = this.getOffsetY();
// NOTE: the cached canvas offsets must be handled in this method
// because there are situations where we need to access the original
// offset positions, i.e. setAbsolutePosition() and drag and drop
if (cachedCanvas) {
offsetX -= cachedCanvas.x;
}
if (cachedCanvas) {
offsetY -= cachedCanvas.y;
}
if(x !== 0 || y !== 0) {
m.translate(x, y);
}