props: dynamic color fixes

This commit is contained in:
jean-emmanuel 2018-02-07 14:42:28 +01:00
parent bccc9049a6
commit ac300a1978
2 changed files with 7 additions and 9 deletions

View file

@ -364,7 +364,7 @@ class Widget extends EventEmitter {
return
case 'color':
this.container.style.setProperty('--color-custom', this.getProp('color') != 'auto' ? this.getProp('color') : 'initial')
this.container.style.setProperty('--color-custom', this.getProp('color') != 'auto' ? this.getProp('color') : '')
return
case 'precision':

View file

@ -202,27 +202,25 @@ class Panel extends Widget {
onPropChanged(propName, options) {
var ret = super.onPropChanged(...arguments)
var ret = super.onPropChanged(propName, options)
switch (propName) {
case 'color':
DOM.each(this.widget, 'canvas', (canvas)=>{
var w = widgetManager.getWidgetByElement(canvas)
if (w.cacheCanvasStyle) {
w.cacheCanvasStyle()
w.batchDraw()
for (var h of this.childrenHashes) {
if (widgetManager.widgets[h]) {
widgetManager.widgets[h].onPropChanged('color')
}
})
}
return
}
return ret
}
onRemove() {
this.off('resize')
super.onRemove()