Skip to content

Commit b80209f

Browse files
committed
Update documentation to mention 'precision' as widget option
1 parent 7ab10b5 commit b80209f

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

guides/README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Slots have the next information:
110110
* **dir**: optional, could be LiteGraph.UP, LiteGraph.RIGHT, LiteGraph.DOWN, LiteGraph.LEFT
111111
* **color_on**: color to render when it is connected
112112
* **color_off**: color to render when it is not connected
113-
113+
114114
To retrieve the data traveling through a link you can call ```node.getInputData``` or ```node.getOutputData```
115115

116116
### Define your Graph Node
@@ -151,7 +151,7 @@ node.onDrawForeground = function(ctx, graphcanvas)
151151
}
152152
```
153153

154-
### Custom Node Behaviour
154+
### Custom Node Behaviour
155155

156156
You can also grab events from the mouse in case your node has some sort of special interactivity.
157157

@@ -187,16 +187,16 @@ function MyNodeType()
187187
```
188188

189189
This is the list of supported widgets:
190-
* **"number"** to change a value of a number, the syntax is ```this.addWidget("number","Number", current_value, callback, { min: 0, max: 100, step: 1} );```
190+
* **"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 } );```
191191
* **"slider"** to change a number by dragging the mouse, the syntax is the same as number.
192192
* **"combo"** to select between multiple choices, the syntax is:
193193

194194
```this.addWidget("combo","Combo", "red", callback, { values:["red","green","blue"]} );```
195-
195+
196196
or if you want to use objects:
197-
197+
198198
```this.addWidget("combo","Combo", value1, callback, { values: { "title1":value1, "title2":value2 } } );```
199-
199+
200200
* **"text"** to edit a short string
201201
* **"toggle"** like a checkbox
202202
* **"button"**
@@ -205,6 +205,7 @@ The fourth optional parameter could be options for the widget, the parameters ac
205205
* **property**: specifies the name of a property to modify when the widget changes
206206
* **min**: min value
207207
* **max**: max value
208+
* **precision**: set the number of digits after decimal point
208209
* **callback**: function to call when the value changes.
209210

210211
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:
@@ -223,7 +224,7 @@ Or if you want to associate a widget with a property of the node, then specify i
223224
function MyNode()
224225
{
225226
this.properties = { surname: "smith" };
226-
this.addWidget("text","Surname","", { property: "surname"}); //this will modify the node.properties
227+
this.addWidget("text","Surname","", { property: "surname"}); //this will modify the node.properties
227228
}
228229
```
229230
## LGraphCanvas
@@ -277,7 +278,7 @@ To define slots for nodes you must use the type LiteGraph.ACTION for inputs, and
277278
function MyNode()
278279
{
279280
this.addInput("play", LiteGraph.ACTION );
280-
this.addInput("onFinish", LiteGraph.EVENT );
281+
this.addInput("onFinish", LiteGraph.EVENT );
281282
}
282283
```
283284

0 commit comments

Comments
 (0)