multixy: allow setting its own value from onValue script while touched

This commit is contained in:
jean-emmanuel 2022-10-27 09:54:05 +02:00
parent f478e463fc
commit 327d461aab
3 changed files with 11 additions and 3 deletions

View file

@ -8,6 +8,7 @@
- widgets
- add folder widget (flat container that doesn't affect layout)
- input: add `maxLength` property
- multixy: allow setting its own value from onValue script while touched
- ui
- add a virtual onscreen keyboard for desktop clients (can be enabled from the clients main menu)

View file

@ -293,7 +293,12 @@ module.exports = class MultiXy extends Pad {
setValue(v, options={}) {
if (!v || !v.length || v.length!=this.npoints * 2) return
if (this.touched && !options.dragged && !options.doubleTap) return this.setValueTouchedQueue = [v, options]
if (
this.touched &&
!options.dragged &&
!options.doubleTap &&
options.fromScript !== this
) return this.setValueTouchedQueue = [v, options]
for (let i=0;i<this.npoints;i++) {
if (!options.dragged) {

View file

@ -67,8 +67,11 @@ class ScriptVm extends Vm {
this.checkContext('set')
var widget = this.getWidget()
var options = deepCopy(this.getValueOptions())
options.fromScript = true
options.fromScript = widget
if (options.dragged) options.dragged = false
// if (id === options.id) options.sync = false // loop stop
@ -81,7 +84,6 @@ class ScriptVm extends Vm {
var widgets
if (id.includes('*')) {
var widget = this.getWidget()
widgets = this.resolveId(
Object.keys(widgetManager.idRoute).filter(key => key.match(new RegExp('^' + id.replace(/\*/g, '.*') + '$')))
).filter(w => w !== widget)