fader: add support for dash/gap size in dashed prop
This commit is contained in:
parent
a3e49f1bcd
commit
de17ac8301
2 changed files with 7 additions and 3 deletions
|
|
@ -54,6 +54,7 @@
|
|||
- fader: removed `meter`
|
||||
- fader: added `gradient`
|
||||
- fader: added `round` design style
|
||||
- fader: support setting dash size and gap size in `dashed` property
|
||||
- switch: added `layout` (including grid)
|
||||
- switch: added `click` mode
|
||||
- plot/eq: removed `smooth`
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ module.exports = class Fader extends Slider {
|
|||
design: {type: 'string', value: 'default', choices: ['default', 'round', 'compact'], help: 'Design style'},
|
||||
horizontal: {type: 'boolean', value: false, help: 'Set to `true` to display the fader horizontally'},
|
||||
pips: {type: 'boolean', value: false, help: 'Set to `true` to show range breakpoints (ignored if `design` is `compact`)'},
|
||||
dashed: {type: 'boolean', value: false, help: 'Set to `true` to display a dashed gauge'},
|
||||
dashed: {type: 'boolean|array', value: false, help: 'Set to `true` to display a dashed gauge. Can be set as an `array` of two numbers : `[dash_size, gap_size]`'},
|
||||
gradient: {type: 'array|object', value: [], help: [
|
||||
'When set, the meter\'s gauge will be filled with a linear color gradient',
|
||||
'- each item must be a CSS color string.',
|
||||
|
|
@ -64,6 +64,9 @@ module.exports = class Fader extends Slider {
|
|||
|
||||
this.gaugeGradient = null
|
||||
|
||||
var dashed = this.getProp('dashed')
|
||||
this.dashed = dashed ? Array.isArray(dashed) ? dashed.map(x=>parseFloat(x)) : [1, 1] : false
|
||||
|
||||
}
|
||||
|
||||
draginitHandle(e) {
|
||||
|
|
@ -176,7 +179,7 @@ module.exports = class Fader extends Slider {
|
|||
d = Math.round(this.percentToCoord(percent)),
|
||||
o = Math.round(this.percentToCoord(this.valueToPercent(this.originValue))),
|
||||
m = this.getProp('horizontal') ? this.height / 2 : this.width / 2,
|
||||
dashed = this.getProp('dashed'),
|
||||
dashed = this.dashed,
|
||||
compact = this.getProp('design') === 'compact'
|
||||
|
||||
this.clear()
|
||||
|
|
@ -200,7 +203,7 @@ module.exports = class Fader extends Slider {
|
|||
}
|
||||
|
||||
|
||||
if (dashed) this.ctx.setLineDash([PXSCALE, PXSCALE])
|
||||
if (dashed) this.ctx.setLineDash([PXSCALE * dashed[0], PXSCALE * dashed[1]])
|
||||
|
||||
|
||||
if (this.cssVars.alphaFillOff) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue