update CHANGELOG with new version

This commit is contained in:
Anton Lavrenov
2016-07-05 09:59:41 +07:00
parent 724dcceace
commit aef5e79981
5 changed files with 51 additions and 15 deletions

View File

@@ -2,6 +2,16 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/). This project adheres to [Semantic Versioning](http://semver.org/).
## [Not released][Not released]
## [1.0.1][2016-07-05]
### Changed
- you can now unset property by `node.x(undefined)` or `node.setAttr('x', null)`
### Fixed
- Bug fix for case when `touchend` event throws error
## [1.0.0][2016-07-05] ## [1.0.0][2016-07-05]
### Fixed ### Fixed

View File

@@ -4029,14 +4029,16 @@
}, },
_setAttr: function(key, val) { _setAttr: function(key, val) {
var oldVal; var oldVal;
if(val !== undefined) {
oldVal = this.attrs[key]; oldVal = this.attrs[key];
if (oldVal === val) { if (oldVal === val) {
return; return;
} }
if (val === undefined || val === null) {
delete this.attrs[key];
} else {
this.attrs[key] = val; this.attrs[key] = val;
this._fireChangeEvent(key, oldVal, val);
} }
this._fireChangeEvent(key, oldVal, val);
}, },
_setComponentAttr: function(key, component, val) { _setComponentAttr: function(key, component, val) {
var oldVal; var oldVal;

2
konva.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -1771,14 +1771,16 @@
}, },
_setAttr: function(key, val) { _setAttr: function(key, val) {
var oldVal; var oldVal;
if(val !== undefined) {
oldVal = this.attrs[key]; oldVal = this.attrs[key];
if (oldVal === val) { if (oldVal === val) {
return; return;
} }
if (val === undefined || val === null) {
delete this.attrs[key];
} else {
this.attrs[key] = val; this.attrs[key] = val;
this._fireChangeEvent(key, oldVal, val);
} }
this._fireChangeEvent(key, oldVal, val);
}, },
_setComponentAttr: function(key, component, val) { _setComponentAttr: function(key, component, val) {
var oldVal; var oldVal;

View File

@@ -76,7 +76,29 @@ suite('Node', function() {
circle.setAttr('foobar', 12); circle.setAttr('foobar', 12);
assert.equal(circle.getAttr('foobar'), 12); assert.equal(circle.getAttr('foobar'), 12);
});
// ======================================================
test('unset attr', function() {
var stage = addStage();
var layer = new Konva.Layer();
var circle = new Konva.Circle({
x: stage.getWidth() / 2,
y: stage.getHeight() / 2,
radius: 70,
fill: 'green',
stroke: 'black',
strokeWidth: 4
});
stage.add(layer.add(circle));
circle.setAttr('x', undefined);
assert.equal(circle.getX(), 0);
circle.y(null);
assert.equal(circle.y(), 0);
}); });
// ====================================================== // ======================================================