fader/range: fix compact mode drawing mistake
This commit is contained in:
parent
8bec0552d4
commit
013b7faf9e
2 changed files with 4 additions and 4 deletions
|
|
@ -313,7 +313,8 @@ class Fader extends Slider {
|
|||
this.ctx.fillStyle = this.cssVars.colorKnob
|
||||
|
||||
this.ctx.beginPath()
|
||||
d = d / (height - this.gaugePadding) * (height-this.gaugePadding - knobHeight)
|
||||
// adjust position to keep knob within gauge boundaries
|
||||
d = (d - this.gaugePadding ) / (height - this.gaugePadding * 2 ) * (height - this.gaugePadding * 2 - knobHeight) + this.gaugePadding
|
||||
this.ctx.rect(this.gaugePadding, d, width - this.gaugePadding * 2, knobHeight)
|
||||
this.ctx.fill()
|
||||
|
||||
|
|
|
|||
|
|
@ -301,16 +301,15 @@ class Range extends Fader {
|
|||
|
||||
this.ctx.globalAlpha = 1
|
||||
this.ctx.fillStyle = this.cssVars.colorKnob
|
||||
var compactAdjust = 1 / (height - this.gaugePadding) * (height-this.gaugePadding - knobHeight)
|
||||
|
||||
this.ctx.beginPath()
|
||||
d *= compactAdjust
|
||||
d = (d - this.gaugePadding ) / (height - this.gaugePadding * 2 ) * (height - this.gaugePadding * 2 - knobHeight) + this.gaugePadding
|
||||
this.ctx.rect(this.gaugePadding, d, width - this.gaugePadding * 2, knobHeight)
|
||||
this.ctx.fill()
|
||||
|
||||
// extra knob
|
||||
this.ctx.beginPath()
|
||||
d2 *= compactAdjust
|
||||
d2 = (d2 - this.gaugePadding ) / (height - this.gaugePadding * 2 ) * (height - this.gaugePadding * 2 - knobHeight) + this.gaugePadding
|
||||
this.ctx.rect(this.gaugePadding, d2, width - this.gaugePadding * 2, knobHeight)
|
||||
this.ctx.fill()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue