ui: more 3d for raised widgets
This commit is contained in:
parent
49f3c51b0a
commit
9d53643312
8 changed files with 32 additions and 13 deletions
|
|
@ -262,7 +262,7 @@ module.exports = class Fader extends _sliders_base {
|
|||
this.ctx.beginPath()
|
||||
this.ctx.rect(m - 9 * PXSCALE, d - 15 * PXSCALE, 18 * PXSCALE, 30 * PXSCALE)
|
||||
this.ctx.lineWidth = PXSCALE
|
||||
this.ctx.fillStyle = this.colors.track
|
||||
this.ctx.fillStyle = this.colors.bg
|
||||
this.ctx.fill()
|
||||
|
||||
this.ctx.beginPath()
|
||||
|
|
@ -277,6 +277,12 @@ module.exports = class Fader extends _sliders_base {
|
|||
this.ctx.strokeStyle = this.colors.light
|
||||
this.ctx.stroke()
|
||||
|
||||
this.ctx.beginPath()
|
||||
this.ctx.rect(m - 8 * PXSCALE, d - 14 * PXSCALE, 16 * PXSCALE, PXSCALE)
|
||||
this.ctx.lineWidth = PXSCALE
|
||||
this.ctx.fillStyle = this.colors.light
|
||||
this.ctx.fill()
|
||||
|
||||
this.ctx.beginPath()
|
||||
this.ctx.rect(m - 4 * PXSCALE, d, 8 * PXSCALE, PXSCALE)
|
||||
this.ctx.fillStyle = this.colors.knob
|
||||
|
|
|
|||
|
|
@ -137,6 +137,8 @@ module.exports = class Knob extends _sliders_base {
|
|||
|
||||
draw() {
|
||||
|
||||
if (!this.width || !this.height) return
|
||||
|
||||
var tiny = this.minDimension < 45,
|
||||
margin = tiny ? 0 : 5 * PXSCALE
|
||||
|
||||
|
|
@ -145,7 +147,7 @@ module.exports = class Knob extends _sliders_base {
|
|||
min = this.percentToAngle(0),
|
||||
max = this.percentToAngle(100),
|
||||
dashed = this.getProp('dashed'),
|
||||
pipsWidth = this.getProp('pips') ? 3 * PXSCALE : 0,
|
||||
pipsWidth = this.getProp('pips') && !tiny ? 3 * PXSCALE : 0,
|
||||
pipsRadius = this.minDimension / 2 - pipsWidth / 2 - margin,
|
||||
gaugeWidth = 7 * PXSCALE,
|
||||
gaugeRadius = pipsRadius - gaugeWidth / 2 - pipsWidth * 1.5,
|
||||
|
|
@ -205,7 +207,7 @@ module.exports = class Knob extends _sliders_base {
|
|||
|
||||
if (dashed) this.ctx.setLineDash([1.5, 1.5])
|
||||
|
||||
this.ctx.strokeStyle = this.colors.track
|
||||
this.ctx.strokeStyle = tiny ? this.colors.light : this.colors.track
|
||||
this.ctx.lineWidth = gaugeWidth - 4.5 * PXSCALE
|
||||
this.ctx.beginPath()
|
||||
this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, min, max)
|
||||
|
|
@ -239,6 +241,13 @@ module.exports = class Knob extends _sliders_base {
|
|||
this.ctx.strokeStyle = this.colors.light
|
||||
this.ctx.stroke()
|
||||
|
||||
var g = this.ctx.createLinearGradient(this.width / 2, this.height / 2 - knobRadius / 2,this.width / 2, this.height / 2 + knobRadius / 2);
|
||||
g.addColorStop(0.5, 'transparent');
|
||||
g.addColorStop(0, this.colors.light);
|
||||
|
||||
this.ctx.strokeStyle = g
|
||||
this.ctx.stroke()
|
||||
|
||||
// cursor
|
||||
this.ctx.globalAlpha = 1
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue