From 5b38c79318ef7d9dc54d06dae1edb58ad497dc37 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 9 Sep 2025 17:02:28 +0200 Subject: [PATCH] canvas: autoClear is only for 2d mode --- src/client/widgets/pads/canvas.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/widgets/pads/canvas.js b/src/client/widgets/pads/canvas.js index ff6ee96d..c9c668d6 100644 --- a/src/client/widgets/pads/canvas.js +++ b/src/client/widgets/pads/canvas.js @@ -21,7 +21,7 @@ class CanvasWidget extends Canvas { 'When calling `set()` from a script, submitted value should be an array only if `valueLength` is greater than 1.' ]}, autoClear: {type: 'boolean', value: true, help: [ - 'If set to `false`, the canvas context won\'t be cleared automatically and `ctx.clearRect()` will need to be called in `onDraw`.' + 'If set to `false`, the canvas context won\'t be cleared automatically and `ctx.clearRect()` will need to be called in `onDraw`. Ignored if `contextType` is different from `2d`.' ]}, continuous: {type: 'boolean|number', value: false, help: [ 'If set to `true`, `onDraw` will be called at each frame, otherwise it will be called only when the widget is touched and when it receives a value.', @@ -156,7 +156,7 @@ class CanvasWidget extends Canvas { if (!this.getProp('onDraw')) return - if (this.getProp('autoClear')) { + if (this.getProp('autoClear') && this.getProp('contextType') === '2d') { this.clear() this.ctx.beginPath() }