matrix: clone matrix: fix children's value storing
This commit is contained in:
parent
b71134d733
commit
e99c7a4b73
4 changed files with 33 additions and 9 deletions
|
|
@ -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)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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'))
|
||||
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue