mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 15:23:44 +08:00
update CHANGELOG with new version
This commit is contained in:
parent
803d3df2b9
commit
902a151699
@ -5,7 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
## [new version][unreleased]
|
## [new version][unreleased]
|
||||||
|
|
||||||
## [2.1.0][2018-05-16]
|
## [2.1.1][2018-05-16]
|
||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
|
|
||||||
@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
* Some performance optimizations for `Konva.Text`
|
* Some performance optimizations for `Konva.Text`
|
||||||
* Better wrap algorithm for `Konva.Text`
|
* Better wrap algorithm for `Konva.Text`
|
||||||
* fixed `Konva.Arrow` with tension != 0
|
* fixed `Konva.Arrow` with tension != 0
|
||||||
|
* Some fixes for `Konva.Transformer`
|
||||||
|
|
||||||
## [2.0.3][2018-04-21]
|
## [2.0.3][2018-04-21]
|
||||||
|
|
||||||
|
@ -166,14 +166,7 @@
|
|||||||
this._node = node;
|
this._node = node;
|
||||||
this._clearCache(NODE_RECT);
|
this._clearCache(NODE_RECT);
|
||||||
|
|
||||||
node.on(
|
node.on(TRANSFORM_CHANGE_STR, this._resetTransformCache.bind(this));
|
||||||
TRANSFORM_CHANGE_STR,
|
|
||||||
function() {
|
|
||||||
this._clearCache(NODE_RECT);
|
|
||||||
this._clearCache('transform');
|
|
||||||
this._clearSelfAndDescendantCache('absoluteTransform');
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
// TODO: why do we need this?
|
// TODO: why do we need this?
|
||||||
var elementsCreated = !!this.findOne('.top-left');
|
var elementsCreated = !!this.findOne('.top-left');
|
||||||
@ -200,6 +193,10 @@
|
|||||||
this.getNode().off('.resizer');
|
this.getNode().off('.resizer');
|
||||||
this._node = undefined;
|
this._node = undefined;
|
||||||
}
|
}
|
||||||
|
this._resetTransformCache();
|
||||||
|
},
|
||||||
|
|
||||||
|
_resetTransformCache: function() {
|
||||||
this._clearCache(NODE_RECT);
|
this._clearCache(NODE_RECT);
|
||||||
this._clearCache('transform');
|
this._clearCache('transform');
|
||||||
this._clearSelfAndDescendantCache('absoluteTransform');
|
this._clearSelfAndDescendantCache('absoluteTransform');
|
||||||
@ -617,7 +614,7 @@
|
|||||||
* @memberof Konva.Transformer.prototype
|
* @memberof Konva.Transformer.prototype
|
||||||
*/
|
*/
|
||||||
forceUpdate: function() {
|
forceUpdate: function() {
|
||||||
this._clearCache(NODE_RECT);
|
this._resetTransformCache();
|
||||||
this.update();
|
this.update();
|
||||||
},
|
},
|
||||||
update: function() {
|
update: function() {
|
||||||
|
@ -1046,4 +1046,51 @@ suite('Transformer', function() {
|
|||||||
y: 100
|
y: 100
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('on force update should clear transform', function() {
|
||||||
|
var stage = addStage();
|
||||||
|
var layer = new Konva.Layer();
|
||||||
|
stage.add(layer);
|
||||||
|
|
||||||
|
var group = new Konva.Group({
|
||||||
|
x: 50,
|
||||||
|
y: 50
|
||||||
|
});
|
||||||
|
layer.add(group);
|
||||||
|
|
||||||
|
var tr = new Konva.Transformer();
|
||||||
|
layer.add(tr);
|
||||||
|
tr.attachTo(group);
|
||||||
|
|
||||||
|
layer.draw();
|
||||||
|
|
||||||
|
assert.equal(tr._cache.transform.m[4], 50);
|
||||||
|
|
||||||
|
var rect = new Konva.Rect({
|
||||||
|
x: 50,
|
||||||
|
y: 50,
|
||||||
|
width: 100,
|
||||||
|
height: 100,
|
||||||
|
fill: 'yellow'
|
||||||
|
});
|
||||||
|
group.add(rect);
|
||||||
|
|
||||||
|
tr.forceUpdate();
|
||||||
|
layer.draw();
|
||||||
|
|
||||||
|
assert.equal(tr._cache.transform.m[4], 100);
|
||||||
|
|
||||||
|
// tr._fitNodeInto({
|
||||||
|
// x: 100,
|
||||||
|
// y: 70,
|
||||||
|
// width: 100,
|
||||||
|
// height: 100
|
||||||
|
// });
|
||||||
|
|
||||||
|
// assert.equal(rect.x(), 100);
|
||||||
|
// assert.equal(rect.y(), 70);
|
||||||
|
// assert.equal(rect.width() * rect.scaleX(), 100);
|
||||||
|
// assert.equal(rect.height() * rect.scaleY(), 100);
|
||||||
|
// assert.equal(rect.rotation(), rect.rotation());
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user