inspector: better layout for editor

This commit is contained in:
jean-emmanuel 2021-12-14 13:04:08 +01:00
parent 661b2d60b0
commit 58872c2814
7 changed files with 92 additions and 84 deletions

View file

@ -137,7 +137,7 @@ class Widget extends EventEmitter {
bypass: {type: 'boolean', value: false, help: 'Set to `true` to prevent the widget from sending any osc message'}
},
scripting: {
script: {type: 'script', value: '', help: ['Script executed whenever the widget\'s value updates. See <a href="https://openstagecontrol.ammd.net/docs/widgets/scripting/">documentation</a>.']},
script: {type: 'script', value: '', editor: 'javascript', help: ['Script executed whenever the widget\'s value updates. See <a href="https://openstagecontrol.ammd.net/docs/widgets/scripting/">documentation</a>.']},
}
}

View file

@ -26,10 +26,10 @@ class CanvasWidget extends Canvas {
'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.',
'Can be a number between 1 and 60 to specify the framerate (default: 30 fps).'
]},
touch: {type: 'string', value: '', help: [
touch: {type: 'string', value: '', editor:'javascript', help: [
'Script executed when the widget is touched. See <a href="https://openstagecontrol.ammd.net/docs/widgets/canvas/">documentation</a>.',
]},
draw: {type: 'string', value: '', help: [
draw: {type: 'string', value: '', editor:'javascript', help: [
'Script executed when the widget is redrawn. See <a href="https://openstagecontrol.ammd.net/docs/widgets/canvas/">documentation</a>.'
]},
}

View file

@ -14,28 +14,26 @@ class Script extends Widget {
static defaults() {
return super.defaults().extend({
widget: {
visible: null,
interaction: null
},
geometry: null,
style: null,
scripting: {
event: {type: 'string', value: 'value', choices: ['value', 'keyboard', 'once'], help: 'Define which events trigger the script\'s execution.'},
var defaults = super.defaults()
delete defaults.widget.visible
delete defaults.widget.interaction
delete defaults.geometry
delete defaults.style
defaults.scripting = {
event: {type: 'string', value: 'value', choices: ['value', 'keyboard', 'once'], help: 'Define which events trigger the script\'s execution.'},
script: {type: 'script', value: '', editor:'javascript', help: 'Script executed whenever the widget receives the defined event. See <a href="https://openstagecontrol.ammd.net/docs/widgets/scripting/">documentation</a>.'},
_separator: 'event: keyboard',
_separator: 'event: keyboard',
keyBinding: {type: 'string|array', value: '', help: [
'Key combo `string` or `array` of strings (see <a href="https://github.com/RobertWHurst/KeyboardJS">KeyboardJS</a> documentation).',
'If the editor is enabled, some keys / combos will not work.'
]},
keyRepeat: {type: 'boolean', value: true, help: 'Set to `false` to prevent keydown repeats when holding the key combo pressed'},
keyType: {type: 'string', value: 'keydown', choices: ['keydown', 'keyup', 'both'], help: 'Determines which key event trigger the script\'s execution'},
keyBinding: {type: 'string|array', value: '', help: [
'Key combo `string` or `array` of strings (see <a href="https://github.com/RobertWHurst/KeyboardJS">KeyboardJS</a> documentation).',
'If the editor is enabled, some keys / combos will not work.'
]},
keyRepeat: {type: 'boolean', value: true, help: 'Set to `false` to prevent keydown repeats when holding the key combo pressed'},
keyType: {type: 'string', value: 'keydown', choices: ['keydown', 'keyup', 'both'], help: 'Determines which key event trigger the script\'s execution'},
script: {type: 'script', value: '', help: 'Script executed whenever the widget receives the defined event. See <a href="https://openstagecontrol.ammd.net/docs/widgets/scripting/">documentation</a>.'},
}
})
}
return defaults
}