From a51957bf642116db9d517862e33f461c50baeeef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 21 May 2011 14:28:08 +0100 Subject: [PATCH] Change PathStyle to clone values in setters if they provide a clone function. This requires also using equals() wherevere they are checked to be the same or different. --- src/item/PathStyle.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/item/PathStyle.js b/src/item/PathStyle.js index 4677a02e..3ec98044 100644 --- a/src/item/PathStyle.js +++ b/src/item/PathStyle.js @@ -63,7 +63,7 @@ var PathStyle = this.PathStyle = Base.extend(new function() { } else { var old = this['_' + key]; if (old != value && !(old && old.equals && old.equals(value))) { - this['_' + key] = value; + this['_' + key] = value && value.clone ? value.clone() : value; if (this._item) { this._item._changed(ChangeFlags.STYLE | (strokeFlags[key] ? ChangeFlags.STROKE : 0)); @@ -83,7 +83,8 @@ var PathStyle = this.PathStyle = Base.extend(new function() { var childStyle = children[i]._style[get](); if (!style) { style = childStyle; - } else if (style != childStyle) { + } else if (style != childStyle && !(style && style.equals + && style.equals(childStyle))) { // If there is another item with a different style, // the style is not defined: // PORT: Change this in Sg (currently returns null) @@ -96,6 +97,7 @@ var PathStyle = this.PathStyle = Base.extend(new function() { } }; + // Style-getters and setters for Item: // 'this' = the Base.each() side-car = the object that is returned from // Base.each and injected into Item above: this[set] = function(value) {