From 3fe936addf2f3d6a71ba13af15a7521ce860f71f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Wed, 14 Nov 2012 12:05:36 -0800 Subject: [PATCH] Expose Palettes through PaperScope#palettes. --- src/core/PaperScope.js | 3 +++ src/ui/Palette.js | 2 ++ 2 files changed, 5 insertions(+) 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() {