fader/fastdom: fix redraw upon resize in horizontal mode

This commit is contained in:
jean-emmanuel 2022-01-26 15:09:39 +01:00
parent fd5421b929
commit 910c0e2468
2 changed files with 21 additions and 8 deletions

View file

@ -66,7 +66,7 @@ class Canvas extends Widget {
resizeHandle(event){
var {width, height, style} = event,
var {width, height, style, preventDraw} = event,
ratio = CANVAS_SCALING * this.scaling
this.height = height
@ -95,12 +95,14 @@ class Canvas extends Widget {
this.ctx.scale(ratio, ratio)
}
if (!this.hasSize) {
this.hasSize = true
this.setVisibility()
this.batchDraw()
} else {
this.draw()
if (!preventDraw) {
if (!this.hasSize) {
this.hasSize = true
this.setVisibility()
this.batchDraw()
} else {
this.draw()
}
}
})

View file

@ -117,6 +117,8 @@ class Fader extends Slider {
var ratio = CANVAS_SCALING * this.scaling
event.preventDraw = true
super.resizeHandle(event)
fastdom.mutate(()=>{
@ -127,6 +129,7 @@ class Fader extends Slider {
this.ctx.translate(-this.height * ratio, 0)
if (ratio != 1) this.ctx.scale(ratio, ratio)
}
if (this.getProp('gradient')) {
@ -166,8 +169,16 @@ class Fader extends Slider {
}
})
if (!this.hasSize) {
this.hasSize = true
this.setVisibility()
this.batchDraw()
} else {
this.draw()
}
})
}