props: make panels/tab's color dynamic (trigger upper nav update and inner canvas style cache)
This commit is contained in:
parent
3b394be366
commit
4099dea1cf
2 changed files with 39 additions and 0 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue