From 2f8f15939eae546faef54246b37d06e34577cd53 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 6 Dec 2021 17:18:01 +0100 Subject: [PATCH] canvas: doc links & better value length check --- src/client/widgets/pads/canvas.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/client/widgets/pads/canvas.js b/src/client/widgets/pads/canvas.js index 10277635..02fa3d9c 100644 --- a/src/client/widgets/pads/canvas.js +++ b/src/client/widgets/pads/canvas.js @@ -27,10 +27,10 @@ class CanvasWidget extends Canvas { 'Can be a number between 1 and 60 to specify the framerate (default: 30 fps).' ]}, touch: {type: 'string', value: '', help: [ - 'Script executed when the widget is touched', + 'Script executed when the widget is touched. See documentation.', ]}, draw: {type: 'string', value: '', help: [ - 'Script executed when the widget is redrawn.' + 'Script executed when the widget is redrawn. See documentation.' ]}, } }) @@ -114,7 +114,9 @@ class CanvasWidget extends Canvas { setValue(v, options={}) { - if (this.valueLength > 1 && Array.isArray(v) && v.length != this.valueLength) return + if (Array.isArray(v)) { + if (v.length !== this.valueLength) return + } else if (this.valueLength > 1) return this.value = v