faders/meter: add css variable --gauge-opacity to allow setting a fixed gauge opacity for meters and compact faders

This commit is contained in:
jean-emmanuel 2018-04-07 11:46:23 +02:00
parent 457d9faff0
commit 91abc1fc8b
8 changed files with 24 additions and 5 deletions

View file

@ -8,6 +8,7 @@
- zeroconf: unpublish when shutting down
- widgets
- modal: added `popupLeft` and `popupTop` properties
- faders/meter: add css variable `--gauge-opacity` to allow setting a fixed gauge opacity for meters and compact faders
- custom module
- messages converted from midi inputs can be filtered

View file

@ -60,7 +60,7 @@ Panels can contains tabs or widgets. These can be absolutely positioned and can
- note: this only applies when the panel contains widgets, not tabs
### `css`
```
```css
--nav-height: number[rem|%];
```

View file

@ -181,7 +181,7 @@ This one works pretty much like the multipush, excepts it looks like a piano key
- see push's [`options`](buttons/#push)
### `css`
```
```css
--color-white:color; /* white keys color */
--color-black:color; /* black keys color */
```

View file

@ -234,6 +234,13 @@ Meter displays incoming numerical values (via osc) as a gauge level
- default: `[]`
- usage: when set, the meter's gauge will be filled with a linear color gradient : each item must be a color string. Example: `["blue", "red"]`
### `css`
```css
--color-gauge:color;
--color-knob:color; /* transparent by default */
--color-pips:color;
--gauge-opacity:number;
```
## Image

View file

@ -103,10 +103,11 @@ range: {
- usage: overrides the `meter`'s osc address
### `css`
```
```css
--color-gauge:color;
--color-knob:color;
--color-pips:color;
--gauge-opacity:number; /* compact mode only */
```
@ -265,3 +266,12 @@ A range is a fader with two handles. To move the range (both handles at once), h
- set to `true` to send separate osc messages for `low` and `high` handles. The `address` will be the same as the widget's with `/low` or `/high` appended to it
- can be set as an object to specify a different `address` : `['/osc_address_low', '/osc_address_high']`
- note: the widget will only respond to its original osc address, not to the splitted version
### `css`
```css
--color-gauge:color;
--color-knob:color;
--color-pips:color;
--gauge-opacity:number; /* compact mode only */
```

View file

@ -225,7 +225,7 @@ module.exports = class Fader extends Slider {
if (this.getProp('compact')) {
this.ctx.globalAlpha = (dashed ? .3 : .2) + 0.2 * Math.abs(d-o) / (d<o?o:height-o)
this.ctx.globalAlpha = this.colors.gaugeOpacity || (dashed ? .3 : .2) + 0.2 * Math.abs(d-o) / (d<o?o:height-o)
this.ctx.strokeStyle = this.colors.gradient || this.colors.gauge
this.ctx.beginPath()

View file

@ -44,7 +44,7 @@ var RangeFader = class RangeFader extends Fader {
if (this.getProp('compact')) {
this.ctx.globalAlpha = (dashed ? .3 : .2) + 0.2 * Math.abs(d-d2) / height
this.ctx.globalAlpha = this.colors.gaugeOpacity || (dashed ? .3 : .2) + 0.2 * Math.abs(d-d2) / height
this.ctx.strokeStyle = this.colors.gauge
this.ctx.beginPath()
this.ctx.moveTo(m, d2)

View file

@ -177,6 +177,7 @@ class Slider extends Canvas {
this.colors.gauge = style.getPropertyValue('--color-gauge')
this.colors.knob = style.getPropertyValue('--color-knob')
this.colors.pips = style.getPropertyValue('--color-pips')
this.colors.gaugeOpacity = style.getPropertyValue('--gauge-opacity')
super.cacheCanvasStyle(style)