canvas: more safe check before drawing
This commit is contained in:
parent
ccba528cbf
commit
c092951052
3 changed files with 6 additions and 3 deletions
|
|
@ -101,7 +101,10 @@ class Canvas extends Widget {
|
|||
this.hasSize = true
|
||||
this.setVisibility()
|
||||
}
|
||||
this.draw()
|
||||
|
||||
if (this.width > 0 && this.height > 0 && this.visible) {
|
||||
this.draw()
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ class Fader extends Slider {
|
|||
this.shouldDrawPips = false
|
||||
}
|
||||
|
||||
if (this.pips) {
|
||||
if (this.pips && this.pips.width && this.pips.height) {
|
||||
this.ctx.globalAlpha = 1
|
||||
this.ctx.drawImage(this.pips, 0, 0)
|
||||
if (!compact) this.clearRect = [this.clearRect, [m + knobWidth / 2, 0, 12 * PXSCALE + this.pipsTextSize, height]]
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ class Range extends Fader {
|
|||
this.shouldDrawPips = false
|
||||
}
|
||||
|
||||
if (this.pips) {
|
||||
if (this.pips && this.pips.width && this.pips.height) {
|
||||
this.ctx.globalAlpha = 1
|
||||
this.ctx.drawImage(this.pips, 0, 0)
|
||||
if (!compact) this.clearRect = [this.clearRect, [m + knobWidth / 2, 0, 12 * PXSCALE + this.pipsTextSize, height]]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue