Merge pull request #384 from MarcMeszaros/guide-number-widget-precision

Update documentation to mention 'precision' as widget option
This commit is contained in:
Javi Agenjo
2023-04-28 11:16:52 +02:00
committed by GitHub

View File

@@ -187,7 +187,7 @@ function MyNodeType()
```
This is the list of supported widgets:
* **"number"** to change a value of a number, the syntax is ```this.addWidget("number","Number", current_value, callback, { min: 0, max: 100, step: 1} );```
* **"number"** to change a value of a number, the syntax is ```this.addWidget("number","Number", current_value, callback, { min: 0, max: 100, step: 1, precision: 3 } );```
* **"slider"** to change a number by dragging the mouse, the syntax is the same as number.
* **"combo"** to select between multiple choices, the syntax is:
@@ -205,6 +205,7 @@ The fourth optional parameter could be options for the widget, the parameters ac
* **property**: specifies the name of a property to modify when the widget changes
* **min**: min value
* **max**: max value
* **precision**: set the number of digits after decimal point
* **callback**: function to call when the value changes.
Widget's value is not serialized by default when storing the node state, but if you want to store the value of widgets just set serialize_widgets to true: