Make Palette#reset() work.

This commit is contained in:
Jürg Lehni 2012-11-14 10:02:16 -08:00
parent 926e5d0b3a
commit b122a85512

View file

@ -20,9 +20,10 @@ var Palette = this.Palette = Base.extend(Callback, /** @lends Palette# */{
initialize: function(title, components, values) { initialize: function(title, components, values) {
var parent = DomElement.find('.paperjs-palettes') var parent = DomElement.find('.paperjs-palettes')
|| DomElement.find('body').appendChild( || DomElement.find('body').appendChild(
DomElement.create('div', { 'class': 'paperjs-palettes' })); DomElement.create('div', { 'class': 'paperjs-palettes' })),
var table = parent.appendChild( table = parent.appendChild(
DomElement.create('table', { 'class': 'paperjs-palette' })); DomElement.create('table', { 'class': 'paperjs-palette' })),
that = this;
this._title = title; this._title = title;
if (!values) if (!values)
values = {}; values = {};
@ -33,7 +34,7 @@ var Palette = this.Palette = Base.extend(Callback, /** @lends Palette# */{
component.name = name; component.name = name;
component = components[name] = new Component(component); component = components[name] = new Component(component);
} }
component.palette = this; component.palette = that;
// Make sure each component has an entry in values, so observers get // Make sure each component has an entry in values, so observers get
// installed further down. // installed further down.
if (values[name] === undefined) if (values[name] === undefined)
@ -44,7 +45,7 @@ var Palette = this.Palette = Base.extend(Callback, /** @lends Palette# */{
'td', component.element 'td', component.element
]) ])
); );
}, this); });
this._values = Base.each(values, function(value, name) { this._values = Base.each(values, function(value, name) {
// Replace each entry with an getter / setters so we can observe // Replace each entry with an getter / setters so we can observe
// change. // change.