props: make panels/tab's color dynamic (trigger upper nav update and inner canvas style cache)

This commit is contained in:
jean-emmanuel 2018-02-06 15:09:50 +01:00
parent 8e98b94fbd
commit 9b6c97d122
2 changed files with 39 additions and 0 deletions

View file

@ -200,6 +200,29 @@ class Panel extends Widget {
}
onPropChanged(propName, options) {
var ret = super.onPropChanged(...arguments)
switch (propName) {
case 'color':
DOM.each(this.widget, 'canvas', (canvas)=>{
var w = widgetManager.getWidgetByElement(canvas)
if (w.cacheCanvasStyle) {
w.cacheCanvasStyle()
w.batchDraw()
}
})
return
}
return ret
}
onRemove() {
this.off('resize')
super.onRemove()

View file

@ -70,4 +70,20 @@ module.exports = class Tab extends Panel {
resize.check(this.widget)
}
onPropChanged(propName, options) {
var ret = super.onPropChanged(...arguments)
switch (propName) {
case 'color':
if (this.parent.createNavigation) this.parent.createNavigation()
return
}
return ret
}
}