|
|
@@ -2,7 +2,7 @@ import { Tab } from '../ui/Tab.js';
|
|
|
import { List } from '../ui/List.js';
|
|
|
import { Item } from '../ui/Item.js';
|
|
|
import { createValueSpan } from '../ui/utils.js';
|
|
|
-import { ValueNumber, ValueSlider, ValueSelect, ValueCheckbox, ValueColor, ValueButton } from '../ui/Values.js';
|
|
|
+import { ValueString, ValueNumber, ValueSlider, ValueSelect, ValueCheckbox, ValueColor, ValueButton } from '../ui/Values.js';
|
|
|
|
|
|
class ParametersGroup {
|
|
|
|
|
|
@@ -52,6 +52,10 @@ class ParametersGroup {
|
|
|
|
|
|
item = this.addBoolean( object, property );
|
|
|
|
|
|
+ } else if ( type === 'string' ) {
|
|
|
+
|
|
|
+ item = this.addString( object, property );
|
|
|
+
|
|
|
} else if ( type === 'function' ) {
|
|
|
|
|
|
item = this.addButton( object, property, ...params );
|
|
|
@@ -106,6 +110,34 @@ class ParametersGroup {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ addString( object, property ) {
|
|
|
+
|
|
|
+ const value = object[ property ];
|
|
|
+
|
|
|
+ const editor = new ValueString( { value } );
|
|
|
+ editor.addEventListener( 'change', ( { value } ) => {
|
|
|
+
|
|
|
+ object[ property ] = value;
|
|
|
+
|
|
|
+ } );
|
|
|
+
|
|
|
+ const description = createValueSpan();
|
|
|
+ description.textContent = property;
|
|
|
+
|
|
|
+ const subItem = new Item( description, editor.domElement );
|
|
|
+ this.paramList.add( subItem );
|
|
|
+
|
|
|
+ const itemRow = subItem.domElement.firstChild;
|
|
|
+ itemRow.classList.add( 'actionable' );
|
|
|
+
|
|
|
+ // extend object property
|
|
|
+
|
|
|
+ this._addParameter( object, property, editor, subItem );
|
|
|
+
|
|
|
+ return editor;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
addFolder( name ) {
|
|
|
|
|
|
const group = new ParametersGroup( this.parameters, name );
|