sliders: scale pips stroke width with font size

fader: use lineWidth in default/round design
This commit is contained in:
bordun 2020-09-07 09:53:20 +02:00
parent 9f68640b83
commit 65b2ff271d
3 changed files with 7 additions and 5 deletions

View file

@ -204,7 +204,7 @@ class Fader extends Slider {
if (compact) {
this.ctx.lineWidth = Math.round(width - this.gaugePadding * 2)
} else {
this.ctx.lineWidth = 2 * PXSCALE
this.ctx.lineWidth = this.cssVars.lineWidth
}
@ -292,7 +292,7 @@ class Fader extends Slider {
this.ctx.fillStyle = this.cssVars.colorStroke
this.ctx.beginPath()
this.ctx.rect(m - 3 * PXSCALE, d, 6 * PXSCALE, PXSCALE)
this.ctx.rect(m - knobWidth / 6, d, knobWidth / 3, PXSCALE)
this.ctx.fill()
this.clearRect = [m - knobWidth / 2 - PXSCALE, this.gaugePadding - knobHeight / 2 - PXSCALE, knobWidth + 2 * PXSCALE, height - 2 * this.gaugePadding + knobHeight + 2 * PXSCALE]
@ -358,7 +358,7 @@ class Fader extends Slider {
if (!compact) m -= 16 * PXSCALE - this.cssVars.knobSize * .3 * PXSCALE
ctx.lineWidth = PXSCALE
ctx.lineWidth = this.fontSize / 11
ctx.fillStyle = this.cssVars.colorText
ctx.strokeStyle = this.cssVars.colorFill

View file

@ -340,7 +340,7 @@ module.exports = class Knob extends Slider {
if (pips) {
this.ctx.lineWidth = this.cssVars.lineWidth / 2 + 0.5 * PXSCALE
this.ctx.lineWidth = this.fontSize / 11 * 1.5
this.ctx.strokeStyle = this.cssVars.colorStroke
this.ctx.globalAlpha = this.cssVars.alphaPips
@ -357,7 +357,6 @@ module.exports = class Knob extends Slider {
this.ctx.stroke()
}
var radius = maxRadius + (this.fontSize + this.cssVars.lineWidth / 2 + 2 * PXSCALE)
this.ctx.fillStyle = this.cssVars.colorText
this.ctx.globalAlpha = this.cssVars.alphaPipsText

View file

@ -18,6 +18,7 @@
--widget-padding: 1rem;
--knob-size: 1rem;
--line-width: 1rem;
canvas {
text-align: left;
@ -34,6 +35,7 @@
--alpha-stroke: 0.5;
--alpha-fill-off: 0.25;
--alpha-fill-on: 1;
--line-width: 2rem
}
&.design-round {
@ -42,6 +44,7 @@
--alpha-stroke: 0.25;
--alpha-fill-off: 0.25;
--alpha-fill-on: 1;
--line-width: 2rem
}
}