diff --git a/resources/docs/docs/widgets/canvas.md b/resources/docs/docs/widgets/canvas.md index f0c870b1..7241ce32 100644 --- a/resources/docs/docs/widgets/canvas.md +++ b/resources/docs/docs/widgets/canvas.md @@ -6,7 +6,22 @@ It has two special properties, `touch` and `draw`, that work like the `script` p This widget requires a good understanding of the javascript [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API) and of the javascript programming language in general. -## `touch` +## Canvas properties + +### `valueLength` + +This property must be set to the number of values held by the widget : 1 for a simple slider, 2 for an XY pad, etc. Attempts to set the widget's value with a different number of values will be ignored. + +### `autoClear` + +This is a convenience option that clears the canvas context and calls [`beginPath`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/beginPath) before each drawing. When this property is set to `false`, the canvas must be cleared manually. + +### `continuous` + +If this property is enabled, the widget will be redrawn at a fixed rate even if not interacted with (see [`draw`](#draw)). + + +### `touch` This script is executed when the widget is touched, when it is released, and during the movement of the pointer while the widget is touched. @@ -24,9 +39,9 @@ This script has access to the same variables and functions as the `script` prope - `altKey`, `ctrlKey`, `shiftKey`: keyboard modifier states -## `draw` +### `draw` -This script is executed when the widget should be redrawn, which is when it's touched and when it receives a value. If the `continuous` property is enabled, the widget will be redrawn at a fixed rate even if not interacted with. +This script is executed when the widget should be redrawn, which is when it's touched and when it receives a value. This script has access to the same variables and functions as the `script` property (except the event-specific ones), plus the following: diff --git a/resources/docs/docs/widgets/properties-reference.md b/resources/docs/docs/widgets/properties-reference.md index 0f8c41b7..ec793638 100644 --- a/resources/docs/docs/widgets/properties-reference.md +++ b/resources/docs/docs/widgets/properties-reference.md @@ -98,6 +98,12 @@ |
"toggle" | Interraction mode:false | Set to `true` to make the button require a double tap to be pushed instead of a single tap |
+ === "scripting"
+
+ | property | type |default | description |
+ | --- | --- | --- | --- |
+ | "" | Script executed whenever the widget's value updates. See documentation."" | Script executed whenever the widget's value updates. See documentation."" | CSS rules. See documentation.1 | Defines the number of values accepted by the widget (minimum 1). Incoming messages that don't comply will be ignoredtrue | If set to `false`, the canvas context won't be cleared automatically and `ctx.clear` will need to be called in `draw`. |
+ | false | If set to `true`, `draw` will be called at each frame, otherwise it will be called only when the widget is touched and when it receives a value."" | Script executed when the widget is touched. See documentation. |
+ | "" | Script executed when the widget is redrawn. See documentation. |
+
+ === "scripting"
+
+ | property | type |default | description |
+ | --- | --- | --- | --- |
+ | "" | Script executed whenever the widget's value updates. See documentation.