canvas: add webgl2 context type as an option

This commit is contained in:
jean-emmanuel 2025-09-09 15:04:05 +02:00
parent 4cde746a74
commit 93ba5d7397
3 changed files with 3 additions and 2 deletions

View file

@ -2,7 +2,7 @@
"name": "open-stage-control",
"productName": "Open Stage Control",
"description": "Libre and modular OSC / MIDI controller",
"version": "1.29.8",
"version": "1.29.9-dev",
"author": {
"name": "Jean-Emmanuel Doucet",
"email": "jean-emmanuel@ammd.net"

View file

@ -30,7 +30,7 @@ class Canvas extends Widget {
this.canvas = DOM.get(this.container, 'canvas')[0]
this.ctx = this.canvas.getContext('2d',{
this.ctx = this.canvas.getContext(this.getProp('contextType') || '2d',{
desynchronized: !ELECTRON_NOGPU && ENV.desynccanvas ? true : false,
alpha: true
})

View file

@ -15,6 +15,7 @@ class CanvasWidget extends Canvas {
var defaults = super.defaults().extend({
class_specific: {
contextType: {type: 'string', value: '2d', choices: ['2d', 'webgl2'], help: 'Context type for the canvas'},
valueLength: {type: 'number', value: 1, help:[
'Defines the number of values accepted by the widget (minimum 1). Incoming messages that don\'t comply will be ignored',
'When calling `set()` from a script, submitted value should be an array only if `valueLength` is greater than 1.'