fader: gradient prop

This commit is contained in:
bordun 2019-10-10 16:34:15 +02:00
parent 4eb6aa29d6
commit 4e2e6e34ca
2 changed files with 11 additions and 2 deletions

View file

@ -21,6 +21,13 @@ module.exports = class Fader extends Slider {
'- the meter\'s `address` will be the same as the widget\'s with `/meter` appended to it'
]},
compact: {type: 'boolean', value: false, help: 'Set to `true` to display a compact alternative for the widget. If `input` is `true`, the input can be focused with a right-click (mouse only). Disables `pips` when enabled.'},
gradient: {type: 'array|object', value: [], help: [
'When set, the fader\'s gauge will be filled with a linear color gradient',
'- each item must be a CSS color string.',
'- as an `object`: each key must be a number between 0 and 1',
'- each item must be a CSS color string.',
'Examples: `[\'blue\', \'red\']`, {\'0\': \'blue\', \'0.9\': \'blue\', \'1\': \'red\'} '
]},
dashed: {type: 'boolean', value: false, help: 'Set to `true` to display a dashed gauge'},
snap: {type: 'boolean', value: false, help: 'By default, dragging the widget will modify it\'s value starting from its last value. Setting this to `true` will make it snap directly to the mouse/touch position'},
spring: {type: 'boolean', value: false, help: 'When set to `true`, the widget will go back to its `default` value when released'},
@ -301,7 +308,7 @@ module.exports = class Fader extends Slider {
this.ctx.beginPath()
this.ctx.globalAlpha = 0.7
this.ctx.strokeStyle = this.colors.gauge
this.ctx.strokeStyle = this.colors.gradient || this.colors.gauge
this.ctx.moveTo(m, o)
this.ctx.lineTo(m, d)
if (dashed) this.ctx.setLineDash([PXSCALE, PXSCALE])