Skip to content

Commit cb61e8d

Browse files
committed
Implement rest of ChangeFlags.HIERARCHY notifications.
1 parent fe7c618 commit cb61e8d

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/item/Item.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@ var Item = this.Item = Base.extend({
671671
item._setProject(this._project);
672672
if (item._name)
673673
item.setName(item._name);
674+
this._changed(ChangeFlags.HIERARCHY);
674675
return true;
675676
}
676677
return false;
@@ -865,9 +866,10 @@ var Item = this.Item = Base.extend({
865866
reverseChildren: function() {
866867
if (this._children) {
867868
this._children.reverse();
868-
for (var i = 0, l = this._children.length; i < l; i++) {
869+
// Adjust inidces
870+
for (var i = 0, l = this._children.length; i < l; i++)
869871
this._children[i]._index = i;
870-
}
872+
this._changed(ChangeFlags.HIERARCHY);
871873
}
872874
},
873875

src/item/Layer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ var Layer = this.Layer = Group.extend({
5858
if (deselect)
5959
this.setSelected(false);
6060
Base.splice(this._project.layers, null, this._index, 1);
61-
// TODO: If notify == true, notify project of hierarchy change
61+
this._project._changed(ChangeFlags.HIERARCHY);
6262
return true;
6363
}
6464
return false;

src/project/Project.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ var Project = this.Project = Base.extend({
5757
this.activeLayer = new Layer();
5858
},
5959

60+
_changed: function(flags) {
61+
if (flags & ChangeFlags.GEOMETRY) {
62+
// TODO: Mark as requireRedraw
63+
}
64+
},
65+
6066
/**
6167
* The currently active path style. All selected items and newly
6268
* created items will be styled with this style.

0 commit comments

Comments
 (0)