mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Implement rest of ChangeFlags.HIERARCHY notifications.
This commit is contained in:
parent
fe7c618deb
commit
cb61e8d452
3 changed files with 11 additions and 3 deletions
|
@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue