lo-th / uil

simple javascript ui
http://lo-th.github.io/uil/
MIT License
555 stars 50 forks source link

Addtion of update for TextInput #16

Closed takashi-tk closed 3 years ago

takashi-tk commented 3 years ago

Needed for using setValue and and listen otherwise the updated value is never displayed.

let guiVars = { sizeMult: 1 };
let ui = new UIL.Gui();
let ti1 = ui.add( 'String', { name: 'Size Multiplier', value: guiVars.sizeMult } );
ui.add( 'slide',  { name: 'Multiplier',  min: 0.25, max: 5, value: guiVars.sizeMult, step: 0.25, precision: 2, h: 20, stype :3 } )
  .onChange( ( v ) => { 
      ti1.setValue( v );
      guiVars.sizeMult = 'Multiplier: ' + v;
  } );
ui.add( guiVars, 'sizeMult', { type: 'String', name: ' ', edit: false } ).listen();