editor: update comments

This commit is contained in:
jean-emmanuel 2018-10-19 15:46:33 +02:00
parent 1b6dfbf085
commit 34ab8cfccb

View file

@ -16,7 +16,6 @@ function updateWidget(widget, options={}) {
if (options.changedProps) {
// alternate routine for small edits
// if props/osc-listeners are modified -> full rebuild instead
var propNames = options.changedProps,
propValues = propNames.map(x => widget.props[x]),
linkedProps = []
@ -26,12 +25,15 @@ function updateWidget(widget, options={}) {
Object.values(widget.oscReceivers).forEach(r => linkedProps = linkedProps.concat(r.propNames))
if (
// if non dynamic props have changed, skip this and use rebuild routine
!propNames.some(n => !widget.constructor.dynamicProps.includes(n))
) {
var edited = widget.updateProps(options.changedProps, null) || widget
if (
// if prop/osc listeners have changed (@{} / OSC{})
// refresh the widget's props cache and update linked props bindings
!propValues.some(x => typeof x === 'string' && x.match(/OSC\{|@\{/))
&& !propNames.some(n => linkedProps.includes(n))
) {
@ -41,7 +43,9 @@ function updateWidget(widget, options={}) {
if (editor.selectedWidgets.includes(widget) && !options.preventSelect) {
editor.select(edited)
}
return edited
}
}