Expose Palettes through PaperScope#palettes.

This commit is contained in:
Jürg Lehni 2012-11-14 12:05:36 -08:00
parent 405198f94d
commit 3fe936addf
2 changed files with 5 additions and 0 deletions

View file

@ -52,6 +52,7 @@ var PaperScope = this.PaperScope = Base.extend(/** @lends PaperScope# */{
this.project = null;
this.projects = [];
this.tools = [];
this.palettes = [];
// Assign an id to this canvas that's either extracted from the script
// or automatically generated.
this._id = script && (script.getAttribute('id') || script.src)
@ -170,6 +171,8 @@ var PaperScope = this.PaperScope = Base.extend(/** @lends PaperScope# */{
this.projects[i].remove();
for (var i = this.tools.length - 1; i >= 0; i--)
this.tools[i].remove();
for (var i = this.palettes.length - 1; i >= 0; i--)
this.palettes[i].remove();
},
remove: function() {

View file

@ -58,6 +58,8 @@ var Palette = this.Palette = Base.extend(Callback, /** @lends Palette# */{
}
});
});
if (window.paper)
paper.palettes.push(this);
},
reset: function() {