From ea0c89b6da587c0610526c19b3fa998ef83714c8 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 11 Jan 2017 22:08:40 +0100 Subject: [PATCH] knob: style: add some light on the inner knob --- src/browser/js/app/widgets/sliders/knob.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/browser/js/app/widgets/sliders/knob.js b/src/browser/js/app/widgets/sliders/knob.js index ab808769..831cc4a5 100644 --- a/src/browser/js/app/widgets/sliders/knob.js +++ b/src/browser/js/app/widgets/sliders/knob.js @@ -206,11 +206,26 @@ module.exports = class Knob extends _sliders_base { } else { + + var r = Math.max(this.minDimension / 2 - (30 + this.margin) * PXSCALE, 2 * PXSCALE) + this.ctx.beginPath() this.ctx.fillStyle = this.colors.raised - this.ctx.arc(this.width / 2, this.height / 2, Math.max(this.minDimension / 2 - (30 + this.margin) * PXSCALE, 2 * PXSCALE), 0, Math.PI * 2) + this.ctx.arc(this.width / 2, this.height / 2, r, 0, Math.PI * 2) this.ctx.fill() + if ( this.colors.raised){ + var grd=this.ctx.createRadialGradient(this.width / 2, this.height / 2, r - 4 * PXSCALE , this.width / 2, this.height / 2, r) + grd.addColorStop(0, 'transparent') + grd.addColorStop(1, this.colors.raised) + } + + this.ctx.beginPath() + this.ctx.fillStyle = grd + this.ctx.arc(this.width / 2, this.height / 2, r, 0, Math.PI * 2) + this.ctx.fill() + + this.ctx.lineWidth = 2 * PXSCALE this.ctx.beginPath() this.ctx.strokeStyle = this.colors.track