fix "same value" detection in setAttr. fix #378

This commit is contained in:
Anton Lavrenov
2018-04-11 09:01:10 +07:00
parent 76d3282fcf
commit f8bd25cbfe
6 changed files with 52 additions and 5 deletions

View File

@@ -1879,7 +1879,8 @@
_setAttr: function(key, val) {
var oldVal;
oldVal = this.attrs[key];
if (oldVal === val) {
var same = oldVal === val;
if (same && !Konva.Util.isObject(val)) {
return;
}
if (val === undefined || val === null) {

View File

@@ -107,7 +107,10 @@
*/
/**
* Transform constructor
* Transform constructor. Transform object is a private class of Konva framework.
* In most of the cases you don't need to use it in your app.
* But there is a documentation for that class in case you still want
* to make some manual calculations.
* @constructor
* @param {Array} [m] Optional six-element matrix
* @memberof Konva
@@ -487,6 +490,10 @@
_isString: function(obj) {
return Object.prototype.toString.call(obj) === OBJECT_STRING;
},
// arrays are objects too
isObject: function(val) {
return val instanceof Object;
},
isValidSelector: function(selector) {
if (typeof selector !== 'string') {
return false;