From a0d832b219264d468626bf975bd30c645f8da3ee Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Fri, 9 Jun 2017 12:12:09 +0200 Subject: [PATCH] knobs: wip enhance design --- src/browser/js/app/widgets/sliders/encoder.js | 15 --------------- src/browser/js/app/widgets/sliders/knob.js | 17 +++++++++-------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/src/browser/js/app/widgets/sliders/encoder.js b/src/browser/js/app/widgets/sliders/encoder.js index b8f1410f..f014d240 100644 --- a/src/browser/js/app/widgets/sliders/encoder.js +++ b/src/browser/js/app/widgets/sliders/encoder.js @@ -22,22 +22,7 @@ var EncoderKnob = class extends Knob { mousewheelHandle(){} } var DisplayKnob = class extends Knob { - draw(){ - super.draw() - if (this.getProp('compact')) { - this.ctx.beginPath() - this.ctx.fillStyle = this.colors.raised - this.ctx.strokeStyle = this.colors.raised - this.ctx.arc(this.width / 2, this.height / 2, this.minDimension / 2 - this.gaugeWidth * 2, 0, Math.PI * 2) - this.ctx.fill() - this.ctx.globalAlpha = 0.3 - this.ctx.lineWidth = 1.1 * PXSCALE - this.ctx.stroke() - this.ctx.globalAlpha = 1 - } - - } } module.exports = class Encoder extends _widgets_base { diff --git a/src/browser/js/app/widgets/sliders/knob.js b/src/browser/js/app/widgets/sliders/knob.js index 2a15971a..f595f4bd 100644 --- a/src/browser/js/app/widgets/sliders/knob.js +++ b/src/browser/js/app/widgets/sliders/knob.js @@ -72,8 +72,7 @@ module.exports = class Knob extends _sliders_base { this.maxAngle = this.getProp('angle') // calculate lost height factor - var a = this.maxAngle <= 180 ? - 1 : 1 - Math.sin((this.maxAngle - 180) / 2 * Math.PI / 180) + var a = 1 - Math.sin((Math.max(this.maxAngle,247.5) - 180) / 2 * Math.PI / 180) this.lostHeightFactor = a / 4 } @@ -182,14 +181,8 @@ module.exports = class Knob extends _sliders_base { this.ctx.arc(this.width / 2, this.height / 2, this.minDimension / 2 - this.gaugeWidth/2 - this.margin * PXSCALE, min, max) this.ctx.stroke() - this.ctx.globalAlpha = 1 - this.ctx.beginPath() - this.ctx.strokeStyle = this.colors.gauge - this.ctx.arc(this.width / 2, this.height / 2, this.minDimension / 2 - this.gaugeWidth/2 - this.margin * PXSCALE, Math.min(o,d), Math.max(o,d)) - this.ctx.stroke() - this.ctx.beginPath() this.ctx.strokeStyle = this.colors.knob @@ -205,6 +198,14 @@ module.exports = class Knob extends _sliders_base { this.ctx.stroke() + this.ctx.beginPath() + this.ctx.fillStyle = this.colors.raised + this.ctx.strokeStyle = this.colors.raised + this.ctx.arc(this.width / 2, this.height / 2, this.minDimension / 2 - this.gaugeWidth * 2, 0, Math.PI * 2) + this.ctx.fill() + this.ctx.globalAlpha = 0.3 + this.ctx.lineWidth = 1.1 * PXSCALE + this.ctx.stroke() } else {