matrix: clone matrix: fix children's value storing

This commit is contained in:
bordun 2019-09-11 21:29:58 +02:00
parent b71134d733
commit e99c7a4b73
4 changed files with 33 additions and 9 deletions

View file

@ -7,6 +7,7 @@
- package: broken build from sources on Windows
- editor: incorrect position when moving a widget from an edge with the keyboard
- modal: prevent touchend event from reaching the inner widgets when opening the container
- matrix: clone matrices not properly storing their children's values
- widgets
- frames: allow loading local html files without requiring a web server to serve them

View file

@ -11,15 +11,6 @@ module.exports = class _matrix_base extends Container {
this.value = []
this.on('change',(e)=>{
if (e.widget === this) return
this.value[e.widget._index] = e.widget.getValue()
this.changed(e.options)
})
if (this.getProp('traversing')) enableTraversingGestures(this.widget)
}

View file

@ -53,6 +53,15 @@ module.exports = class Keyboard extends _matrix_base {
super(options)
this.on('change',(e)=>{
if (e.widget === this) return
this.value[e.widget._index] = e.widget.getValue()
this.changed(e.options)
})
var start = parseInt(this.getProp('start')),
keys = parseInt(this.getProp('keys'))

View file

@ -38,6 +38,29 @@ class Matrix extends _matrix_base {
super(options)
this.on('change',(e)=>{
if (e.widget === this) return
if (this.getProp('widgetType') === 'clone') {
if (e.widget.parent.parent !== this) return
this.value[e.widget.parent._index] = e.widget.getValue()
} else {
if (e.widget.parent !== this) return
this.value[e.widget._index] = e.widget.getValue()
}
this.changed(e.options)
})
this.widget.style.setProperty('--columns', this.getProp('matrix')[0])
this.widget.style.setProperty('--rows', this.getProp('matrix')[1])
this.widget.style.setProperty('--spacing', this.getProp('spacing') + 'rem')