update CHANGELOG with new version

This commit is contained in:
Anton Lavrenov 2018-05-16 12:32:57 +09:00
parent 803d3df2b9
commit 902a151699
3 changed files with 55 additions and 10 deletions

View File

@ -5,7 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [new version][unreleased]
## [2.1.0][2018-05-16]
## [2.1.1][2018-05-16]
## Fixed
@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* Some performance optimizations for `Konva.Text`
* Better wrap algorithm for `Konva.Text`
* fixed `Konva.Arrow` with tension != 0
* Some fixes for `Konva.Transformer`
## [2.0.3][2018-04-21]

View File

@ -166,14 +166,7 @@
this._node = node;
this._clearCache(NODE_RECT);
node.on(
TRANSFORM_CHANGE_STR,
function() {
this._clearCache(NODE_RECT);
this._clearCache('transform');
this._clearSelfAndDescendantCache('absoluteTransform');
}.bind(this)
);
node.on(TRANSFORM_CHANGE_STR, this._resetTransformCache.bind(this));
// TODO: why do we need this?
var elementsCreated = !!this.findOne('.top-left');
@ -200,6 +193,10 @@
this.getNode().off('.resizer');
this._node = undefined;
}
this._resetTransformCache();
},
_resetTransformCache: function() {
this._clearCache(NODE_RECT);
this._clearCache('transform');
this._clearSelfAndDescendantCache('absoluteTransform');
@ -617,7 +614,7 @@
* @memberof Konva.Transformer.prototype
*/
forceUpdate: function() {
this._clearCache(NODE_RECT);
this._resetTransformCache();
this.update();
},
update: function() {

View File

@ -1046,4 +1046,51 @@ suite('Transformer', function() {
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());
});
});