update CHANGELOG with new version

This commit is contained in:
Anton Lavrenov
2018-03-15 14:11:01 +07:00
parent e8b3059e0b
commit 2f4e127103
5 changed files with 46 additions and 5 deletions

View File

@@ -5,6 +5,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [new version][unreleased] ## [new version][unreleased]
## [2.0.1][2018-03-15]
## Fixed
* Several bugs fixes for `Konva.Transformer`
## [2.0.0][2018-03-15] ## [2.0.0][2018-03-15]

View File

@@ -18670,6 +18670,7 @@
this.detach(); this.detach();
} }
this._node = node; this._node = node;
this._clearCache(NODE_RECT);
node.on( node.on(
TRANSFORM_CHANGE_STR, TRANSFORM_CHANGE_STR,
@@ -18691,7 +18692,9 @@
}, },
detach: function() { detach: function() {
this.getNode().off('.resizer'); if (this.getNode()) {
this.getNode().off('.resizer');
}
}, },
_getNodeRect: function() { _getNodeRect: function() {
@@ -19150,7 +19153,7 @@
}, },
destroy: function() { destroy: function() {
Konva.Group.prototype.destroy.call(this); Konva.Group.prototype.destroy.call(this);
this.getNode().off('.resizer'); this.detach();
this._removeEvents(); this._removeEvents();
}, },
// do not work as a container // do not work as a container

2
konva.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -156,6 +156,7 @@
this.detach(); this.detach();
} }
this._node = node; this._node = node;
this._clearCache(NODE_RECT);
node.on( node.on(
TRANSFORM_CHANGE_STR, TRANSFORM_CHANGE_STR,
@@ -177,7 +178,9 @@
}, },
detach: function() { detach: function() {
this.getNode().off('.resizer'); if (this.getNode()) {
this.getNode().off('.resizer');
}
}, },
_getNodeRect: function() { _getNodeRect: function() {
@@ -636,7 +639,7 @@
}, },
destroy: function() { destroy: function() {
Konva.Group.prototype.destroy.call(this); Konva.Group.prototype.destroy.call(this);
this.getNode().off('.resizer'); this.detach();
this._removeEvents(); this._removeEvents();
}, },
// do not work as a container // do not work as a container

View File

@@ -642,4 +642,34 @@ suite('Transformer', function() {
layer.draw(); layer.draw();
}); });
test('reset attrs on node set', function() {
var stage = addStage();
var layer = new Konva.Layer();
stage.add(layer);
var rect = new Konva.Rect({
x: 100,
y: 60,
draggable: true,
width: 100,
height: 100,
fill: 'yellow'
});
layer.add(rect);
var tr = new Konva.Transformer();
layer.add(tr);
layer.draw();
assert.equal(tr.getWidth(), 0);
tr.attachTo(rect);
assert.equal(tr.getWidth(), 100);
});
test('can destroy without attached node', function() {
var tr = new Konva.Transformer();
tr.destroy();
});
}); });