Implement rest of ChangeFlags.HIERARCHY notifications.

This commit is contained in:
Jürg Lehni 2011-06-19 21:49:26 +01:00
parent fe7c618deb
commit cb61e8d452
3 changed files with 11 additions and 3 deletions

View file

@ -671,6 +671,7 @@ var Item = this.Item = Base.extend({
item._setProject(this._project);
if (item._name)
item.setName(item._name);
this._changed(ChangeFlags.HIERARCHY);
return true;
}
return false;
@ -865,9 +866,10 @@ var Item = this.Item = Base.extend({
reverseChildren: function() {
if (this._children) {
this._children.reverse();
for (var i = 0, l = this._children.length; i < l; i++) {
// Adjust inidces
for (var i = 0, l = this._children.length; i < l; i++)
this._children[i]._index = i;
}
this._changed(ChangeFlags.HIERARCHY);
}
},

View file

@ -58,7 +58,7 @@ var Layer = this.Layer = Group.extend({
if (deselect)
this.setSelected(false);
Base.splice(this._project.layers, null, this._index, 1);
// TODO: If notify == true, notify project of hierarchy change
this._project._changed(ChangeFlags.HIERARCHY);
return true;
}
return false;

View file

@ -57,6 +57,12 @@ var Project = this.Project = Base.extend({
this.activeLayer = new Layer();
},
_changed: function(flags) {
if (flags & ChangeFlags.GEOMETRY) {
// TODO: Mark as requireRedraw
}
},
/**
* The currently active path style. All selected items and newly
* created items will be styled with this style.