diff --git a/src/core/PaperScope.js b/src/core/PaperScope.js index 7a5d3e39..81cc3521 100644 --- a/src/core/PaperScope.js +++ b/src/core/PaperScope.js @@ -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() { diff --git a/src/ui/Palette.js b/src/ui/Palette.js index 2ee9f086..38cea2db 100644 --- a/src/ui/Palette.js +++ b/src/ui/Palette.js @@ -58,6 +58,8 @@ var Palette = this.Palette = Base.extend(Callback, /** @lends Palette# */{ } }); }); + if (window.paper) + paper.palettes.push(this); }, reset: function() {