diff --git a/CHANGELOG.md b/CHANGELOG.md index ea8b3213..6080f189 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.31.2 + +- widgets + - canvas: allow `onResize` to send and trigger widget synchronization and scripts + ## 1.31.1 - bug fixes diff --git a/resources/docs/docs/widgets/canvas.md b/resources/docs/docs/widgets/canvas.md index 5ae9bb0d..dffea008 100644 --- a/resources/docs/docs/widgets/canvas.md +++ b/resources/docs/docs/widgets/canvas.md @@ -2,7 +2,7 @@ The canvas widget allows creating custom widgets with user-defined drawings and touch reactions. -It has two special properties, `touch` and `draw`, that work like the `script` property : they are used to defined scripts that will be executed when specific events occurs. +It has dedicated scripting properties (`onTouch`, `onDraw` and `onResize`) that work like the `onValue` property : they are used to defined scripts that will be executed when specific events occurs. 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. @@ -30,7 +30,7 @@ If this property is enabled, the widget will be redrawn at a fixed rate even if 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. -This script has access to the same variables and functions as the `script` property (except the event-specific ones), plus the following: +This script has access to the same variables and functions as the `onValue` property (except the event-specific ones), plus the following: - `value`: widget value - `width`: canvas width in pixels @@ -59,7 +59,7 @@ This script has access to the same variables and functions as the `script` prope 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: +This script has access to the same variables and functions as the `onValue` property (except the event-specific ones), plus the following: - `value`: widget value - `width`: canvas width in pixels @@ -67,11 +67,13 @@ This script has access to the same variables and functions as the `script` prope - `ctx`: [canvas rendering context](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D) of the widget - `cssVars`: object containing the computed value of some of the widget's style properties such as `colorWidget`, `alphaFill`, `padding`, etc +In this script, all osc messages emissions are prevented and changing the value of a widget won't trigger widget synchronisation / scripts / advanced syntaxes updates. + ### `onResize` This script is executed when the widget has resized, before it is redrawn. -This script has access to the same variables and functions as the `script` property (except the event-specific ones), plus the following: +This script has access to the same variables and functions as the `onValue` property (except the event-specific ones), plus the following: - `value`: widget value - `width`: canvas width in pixels diff --git a/resources/docs/docs/widgets/scripting.md b/resources/docs/docs/widgets/scripting.md index 090bd3a0..c02e975c 100644 --- a/resources/docs/docs/widgets/scripting.md +++ b/resources/docs/docs/widgets/scripting.md @@ -123,6 +123,8 @@ The following variables are available in this context: This script is specific to the root widget, it's called before any other widget is created and can be used to create global variables / functions accessible in other scripts. +In this script, all osc messages emissions are prevented and changing the value of a widget won't trigger widget synchronisation / scripts / advanced syntaxes updates. + ## Available variables The following variables and functions are accessible in this context. diff --git a/src/client/widgets/pads/canvas.mjs b/src/client/widgets/pads/canvas.mjs index 052d81ca..8b0c62e1 100644 --- a/src/client/widgets/pads/canvas.mjs +++ b/src/client/widgets/pads/canvas.mjs @@ -180,7 +180,7 @@ class CanvasWidget extends Canvas { width: this.width, height: this.height, cssVars: this.cssVars - }, {sync: false, send: false}) + }, {sync: true, send: true}) }