From b122a85512068c3403689aea6679bdf1df5ed469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Wed, 14 Nov 2012 10:02:16 -0800 Subject: [PATCH] Make Palette#reset() work. --- src/ui/Palette.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ui/Palette.js b/src/ui/Palette.js index 4c3fde64..63d0be4b 100644 --- a/src/ui/Palette.js +++ b/src/ui/Palette.js @@ -20,9 +20,10 @@ var Palette = this.Palette = Base.extend(Callback, /** @lends Palette# */{ initialize: function(title, components, values) { var parent = DomElement.find('.paperjs-palettes') || DomElement.find('body').appendChild( - DomElement.create('div', { 'class': 'paperjs-palettes' })); - var table = parent.appendChild( - DomElement.create('table', { 'class': 'paperjs-palette' })); + DomElement.create('div', { 'class': 'paperjs-palettes' })), + table = parent.appendChild( + DomElement.create('table', { 'class': 'paperjs-palette' })), + that = this; this._title = title; if (!values) values = {}; @@ -33,7 +34,7 @@ var Palette = this.Palette = Base.extend(Callback, /** @lends Palette# */{ component.name = name; component = components[name] = new Component(component); } - component.palette = this; + component.palette = that; // Make sure each component has an entry in values, so observers get // installed further down. if (values[name] === undefined) @@ -44,7 +45,7 @@ var Palette = this.Palette = Base.extend(Callback, /** @lends Palette# */{ 'td', component.element ]) ); - }, this); + }); this._values = Base.each(values, function(value, name) { // Replace each entry with an getter / setters so we can observe // change.