dataarts / dat.gui

Lightweight controller library for JavaScript.
Apache License 2.0
7.46k stars 1.08k forks source link

Numeric input does not update min and max values #294

Open onthez opened 3 years ago

onthez commented 3 years ago

When updating the min and max values after a numeric slider control has been created, the slider updates appropriately with the new limits, but the input field continues to restrict the values to the initial min and max.

Here is a quick fiddle. https://jsfiddle.net/ahqpmzLk/

Try inputting a number over 20 and it will be reduced to 20, but if you use the slider you can go up to 50. Similarly when typing in a number between 0 and 10 it will jump to 10 even though the slider correctly allows lower values.

Swampen commented 3 years ago

Use the max() and min() functions on the controller instead. https://github.com/dataarts/dat.gui/blob/master/API.md#numbercontrollerminminvalue--datcontrollersnumbercontroller

control.min(0)
control.max(50)