fader: draw pips during batched draw call (fixes a glitch and an error)

This commit is contained in:
jean-emmanuel 2025-02-08 10:57:33 +01:00
parent 24629f302d
commit 16da4bbada
2 changed files with 12 additions and 1 deletions

View file

@ -1,5 +1,10 @@
# Changelog
## next
- bug fixes
- fader: pips drawing issue causing small a position offset or errors with some browsers
## 1.27.3
- bug fixes

View file

@ -66,6 +66,7 @@ class Fader extends Slider {
this.container.classList.toggle('horizontal', this.getProp('horizontal'))
this.gaugeGradient = null
this.shouldDrawPips = false
var dashed = this.getProp('dashed')
this.dashed = dashed ? Array.isArray(dashed) ? dashed.map(x=>parseFloat(x)) : [1, 1] : false
@ -172,7 +173,7 @@ class Fader extends Slider {
super.cacheCanvasStyle(style)
if (this.getProp('pips') && this.getProp('design') !== 'compact') this.drawPips()
if (this.getProp('pips') && this.getProp('design') !== 'compact') this.shouldDrawPips = true
}
@ -324,6 +325,11 @@ class Fader extends Slider {
}
if (this.shouldDrawPips) {
this.drawPips()
this.shouldDrawPips = false
}
if (this.getProp('pips') && !compact) {
this.ctx.globalAlpha = 1
this.ctx.drawImage(this.pips, 0, 0)