dynamic props: generic fix for circular prop update
This commit is contained in:
parent
fb041ef437
commit
a5f651bb53
3 changed files with 8 additions and 6 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
- bug fixes
|
||||
- osc receivers: unregister properly when widgets are recreated (memory leak); allow non-string values (eg. objects)
|
||||
- circular property update issues
|
||||
- widgets
|
||||
- **new** generic `matrix` widget
|
||||
- fader: restore right-click focusing the input in compact mode (mouse only)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ module.exports = class OscReceiver {
|
|||
} catch (err) {
|
||||
this.value = value
|
||||
}
|
||||
|
||||
|
||||
this.parent = parent
|
||||
this.propName = propName
|
||||
this.bindedCallback = this.callback.bind(this)
|
||||
|
|
@ -47,7 +47,6 @@ module.exports = class OscReceiver {
|
|||
} catch (err) {
|
||||
this.value = val
|
||||
}
|
||||
console.log(this.value)
|
||||
this.parent.updateProps([this.propName], this.parent)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class Widget extends EventEmitter {
|
|||
if (widget == this) id = 'this'
|
||||
if (widget == this.parent) id = 'parent'
|
||||
if (this.linkedProps[id]) {
|
||||
this.updateProps(this.linkedProps[id], widget, options)
|
||||
this.updateProps(this.linkedProps[id], widget, options, e.props)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ class Widget extends EventEmitter {
|
|||
if (widget == this) id = 'this'
|
||||
if (widget == this.parent) id = 'parent'
|
||||
if (this.linkedPropsValue[id]) {
|
||||
this.updateProps(this.linkedPropsValue[id], widget, options, true)
|
||||
this.updateProps(this.linkedPropsValue[id], widget, options, ['value'])
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -417,7 +417,7 @@ class Widget extends EventEmitter {
|
|||
return this.cachedProps[propName]
|
||||
}
|
||||
|
||||
updateProps(propNames, widget, options, value) {
|
||||
updateProps(propNames, widget, options, updatedProps = []) {
|
||||
|
||||
if (propNames.includes('value')) {
|
||||
propNames.splice(propNames.indexOf('value'), 1)
|
||||
|
|
@ -429,6 +429,8 @@ class Widget extends EventEmitter {
|
|||
|
||||
for (var propName of propNames) {
|
||||
|
||||
if (widget === this && updatedProps.includes(propName)) continue
|
||||
|
||||
let propValue = this.resolveProp(propName, undefined, false),
|
||||
oldPropValue = this.getProp(propName)
|
||||
|
||||
|
|
@ -450,7 +452,7 @@ class Widget extends EventEmitter {
|
|||
|
||||
}
|
||||
}
|
||||
if (reCreate && this.childrenHashes.indexOf(widget.hash) == -1 && !(value && widget == this)) {
|
||||
if (reCreate && this.childrenHashes.indexOf(widget.hash) == -1) {
|
||||
|
||||
this.reCreateWidget()
|
||||
return true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue