mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Expose Palette#components and #values.
This commit is contained in:
parent
3da3161a33
commit
baa022237c
1 changed files with 9 additions and 4 deletions
|
@ -18,6 +18,11 @@
|
||||||
_class: 'Palette',
|
_class: 'Palette',
|
||||||
_events: [ 'onChange' ],
|
_events: [ 'onChange' ],
|
||||||
|
|
||||||
|
// DOCS: Palette#initialize
|
||||||
|
// DOCS: Palette#components
|
||||||
|
// DOCS: Palette#values
|
||||||
|
// DOCS: Palette#remove()
|
||||||
|
|
||||||
initialize: function Palette(title, components, values) {
|
initialize: function Palette(title, components, values) {
|
||||||
var parent = DomElement.find('.palettejs-panel')
|
var parent = DomElement.find('.palettejs-panel')
|
||||||
|| DomElement.find('body').appendChild(
|
|| DomElement.find('body').appendChild(
|
||||||
|
@ -27,7 +32,7 @@
|
||||||
this._title = title;
|
this._title = title;
|
||||||
if (!values)
|
if (!values)
|
||||||
values = {};
|
values = {};
|
||||||
for (var name in (this._components = components)) {
|
for (var name in (this.components = components)) {
|
||||||
var component = components[name];
|
var component = components[name];
|
||||||
if (!(component instanceof Component)) {
|
if (!(component instanceof Component)) {
|
||||||
if (component.value == null)
|
if (component.value == null)
|
||||||
|
@ -44,7 +49,7 @@
|
||||||
}
|
}
|
||||||
// Now replace each entry in values with a getter / setters so we can
|
// Now replace each entry in values with a getter / setters so we can
|
||||||
// directly link the value to the component and observe change.
|
// directly link the value to the component and observe change.
|
||||||
this._values = Base.each(values, function(value, name) {
|
this.values = Base.each(values, function(value, name) {
|
||||||
var component = components[name];
|
var component = components[name];
|
||||||
if (component) {
|
if (component) {
|
||||||
Base.define(values, name, {
|
Base.define(values, name, {
|
||||||
|
@ -68,8 +73,8 @@
|
||||||
* {@link Component#defaultValue}.
|
* {@link Component#defaultValue}.
|
||||||
*/
|
*/
|
||||||
reset: function() {
|
reset: function() {
|
||||||
for (var i in this._components)
|
for (var i in this.components)
|
||||||
this._components[i].reset();
|
this.components[i].reset();
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function() {
|
remove: function() {
|
||||||
|
|
Loading…
Reference in a new issue