mirror of
https://github.com/konvajs/konva.git
synced 2026-01-18 19:51:21 +08:00
fixed drag and drop regression by busting the transform cache inside the clearTransform method
This commit is contained in:
15
src/Node.js
15
src/Node.js
@@ -99,6 +99,10 @@
|
||||
this.on(transformChangeStr, _clearTransformCache);
|
||||
this.on('visibleChange.kinetic', _clearVisibleCache);
|
||||
this.on('opacityChange.kinetic', _clearAbsoluteOpacityCache);
|
||||
|
||||
this._clearTransformCache = _clearTransformCache;
|
||||
this._clearVisibleCache = _clearVisibleCache;
|
||||
this._clearAbsoluteOpacityCache = _clearAbsoluteOpacityCache;
|
||||
},
|
||||
_handleCache: function(attr) {
|
||||
var func;
|
||||
@@ -838,7 +842,8 @@
|
||||
* @memberof Kinetic.Node.prototype
|
||||
*/
|
||||
getAbsoluteTransform: function() {
|
||||
return this._getCache(ABSOLUTE_TRANSFORM, this._getAbsoluteTransform);
|
||||
return this._getAbsoluteTransform();
|
||||
//return this._getCache(ABSOLUTE_TRANSFORM, this._getAbsoluteTransform);
|
||||
},
|
||||
_getAbsoluteTransform: function() {
|
||||
// absolute transform
|
||||
@@ -1080,6 +1085,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* clears the transform and returns the original transform
|
||||
*/
|
||||
_clearTransform: function() {
|
||||
|
||||
var trans = {
|
||||
@@ -1104,6 +1112,8 @@
|
||||
this.attrs.skewX = 0;
|
||||
this.attrs.skewY = 0;
|
||||
|
||||
this._clearTransformCache();
|
||||
|
||||
return trans;
|
||||
},
|
||||
_setTransform: function(trans) {
|
||||
@@ -1113,7 +1123,7 @@
|
||||
this.attrs[key] = trans[key];
|
||||
}
|
||||
|
||||
delete this.cache.transform;
|
||||
this._clearTransformCache();
|
||||
},
|
||||
_fireBeforeChangeEvent: function(attr, oldVal, newVal) {
|
||||
this._fire(BEFORE + Kinetic.Util._capitalize(attr) + CHANGE, {
|
||||
@@ -1231,6 +1241,7 @@
|
||||
* @memberof Kinetic.Node.prototype
|
||||
*/
|
||||
getTransform: function() {
|
||||
//return this._getTransform();
|
||||
return this._getCache(TRANSFORM, this._getTransform);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<script src="../js/performanceTests.js"></script>
|
||||
|
||||
<!-- versions -->
|
||||
<!--
|
||||
|
||||
<script src="http://d3lp1msu2r81bx.cloudfront.net/kjs/js/lib/kinetic-v4.5.2.min.js"></script>
|
||||
<script>
|
||||
run(Kinetic);
|
||||
@@ -28,7 +28,7 @@
|
||||
<script>
|
||||
run(Kinetic);
|
||||
</script>
|
||||
-->
|
||||
|
||||
<script src="../../dist/kinetic-dev.js"></script>
|
||||
<script>
|
||||
run(Kinetic);
|
||||
|
||||
@@ -1444,8 +1444,7 @@ Test.Modules.DRAG_AND_DROP = {
|
||||
offset: {
|
||||
x: 50,
|
||||
y: 25
|
||||
},
|
||||
dragOnTop: true
|
||||
}
|
||||
});
|
||||
|
||||
group.add(rect);
|
||||
|
||||
Reference in New Issue
Block a user