From f115072e8c672f40515fbd7c395f7ea43be23458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 17 Mar 2014 18:59:10 +0100 Subject: [PATCH] Rename HIERARCHY change-flag to more precise CHILDREN. --- src/item/ChangeFlag.js | 9 ++++----- src/item/Group.js | 2 +- src/item/Item.js | 14 +++++++------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/item/ChangeFlag.js b/src/item/ChangeFlag.js index fdf28815..00ed7e30 100644 --- a/src/item/ChangeFlag.js +++ b/src/item/ChangeFlag.js @@ -15,7 +15,7 @@ var ChangeFlag = { // STROKE, STYLE and ATTRIBUTE (except for the invisible ones: locked, name) APPEARANCE: 0x1, // Change in item hierarchy - HIERARCHY: 0x2, + CHILDREN: 0x2, // Item geometry (path, bounds) GEOMETRY: 0x4, // Only segment(s) have changed, and affected curves have alredy been @@ -37,10 +37,9 @@ var ChangeFlag = { // Shortcuts to often used ChangeFlag values including APPEARANCE var Change = { - // HIERARCHY also changes GEOMETRY, since removing children from groups - // change bounds - HIERARCHY: ChangeFlag.HIERARCHY | ChangeFlag.GEOMETRY - | ChangeFlag.APPEARANCE, + // CHILDREN also changes GEOMETRY, since removing children from groups + // changes bounds. + CHILDREN: ChangeFlag.CHILDREN | ChangeFlag.GEOMETRY | ChangeFlag.APPEARANCE, GEOMETRY: ChangeFlag.GEOMETRY | ChangeFlag.APPEARANCE, SEGMENTS: ChangeFlag.SEGMENTS | ChangeFlag.GEOMETRY | ChangeFlag.APPEARANCE, STROKE: ChangeFlag.STROKE | ChangeFlag.STYLE | ChangeFlag.APPEARANCE, diff --git a/src/item/Group.js b/src/item/Group.js index 19eeb337..841d760c 100644 --- a/src/item/Group.js +++ b/src/item/Group.js @@ -99,7 +99,7 @@ var Group = Item.extend(/** @lends Group# */{ _changed: function _changed(flags) { _changed.base.call(this, flags); - if (flags & (/*#=*/ ChangeFlag.HIERARCHY | /*#=*/ ChangeFlag.CLIPPING)) { + if (flags & (/*#=*/ ChangeFlag.CHILDREN | /*#=*/ ChangeFlag.CLIPPING)) { // Clear cached clip item whenever hierarchy changes this._clipItem = undefined; } diff --git a/src/item/Item.js b/src/item/Item.js index 7441cf45..18b9715d 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -251,11 +251,11 @@ var Item = Base.extend(Callback, /** @lends Item# */{ // the parent, see getBounds(). Item._clearBoundsCache(cacheParent); } - if (flags & /*#=*/ ChangeFlag.HIERARCHY) { + if (flags & /*#=*/ ChangeFlag.CHILDREN) { // Clear cached bounds of all items that this item contributes to. // We don't call this on the parent, since we're already the parent // of the child that modified the hierarchy (that's where these - // HIERARCHY notifications go) + // CHILDREN notifications go) Item._clearBoundsCache(this); } if (project) { @@ -960,7 +960,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{ // Set up a boundsCache structure that keeps track of items that keep // cached bounds that depend on this item. We store this in our parent, // for multiple reasons: - // The parent receives HIERARCHY change notifications for when its + // The parent receives CHILDREN change notifications for when its // children are added or removed and can thus clear the cache, and we // save a lot of memory, e.g. when grouping 100 items and asking the // group for its bounds. If stored on the children, we would have 100 @@ -2012,7 +2012,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{ if (item._name) item.setName(item._name); } - this._changed(/*#=*/ Change.HIERARCHY); + this._changed(/*#=*/ Change.CHILDREN); } else { items = null; } @@ -2166,7 +2166,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{ this._installEvents(false); // Notify parent of changed hierarchy if (notify) - this._parent._changed(/*#=*/ Change.HIERARCHY); + this._parent._changed(/*#=*/ Change.CHILDREN); this._parent = null; return true; } @@ -2213,7 +2213,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{ for (var i = removed.length - 1; i >= 0; i--) removed[i]._remove(false); if (removed.length > 0) - this._changed(/*#=*/ Change.HIERARCHY); + this._changed(/*#=*/ Change.CHILDREN); return removed; }, @@ -2229,7 +2229,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{ // Adjust inidces for (var i = 0, l = this._children.length; i < l; i++) this._children[i]._index = i; - this._changed(/*#=*/ Change.HIERARCHY); + this._changed(/*#=*/ Change.CHILDREN); } },