From ab4e923c03360a152643d9841e17a1441ec7e75b Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 16 Nov 2016 09:33:45 +0100 Subject: [PATCH] faders: compact pips: avoid subpixel, use track/gauge color depending on the value --- src/browser/js/app/widgets/sliders/fader.js | 37 ++++++++++++++------- src/browser/js/jquery/jquery.drag.js | 5 +++ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/browser/js/app/widgets/sliders/fader.js b/src/browser/js/app/widgets/sliders/fader.js index 45c30a45..1b5caaba 100644 --- a/src/browser/js/app/widgets/sliders/fader.js +++ b/src/browser/js/app/widgets/sliders/fader.js @@ -158,15 +158,22 @@ Fader.prototype.draw = function(){ if (this.widgetData.horizontal) { if (this.widgetData.compact) { - if (!this.widgetData.noPip) { this.ctx.lineWidth = PXSCALE - this.ctx.strokeStyle = this.colors.text - this.ctx.globalAlpha = 0.05 + this.ctx.globalAlpha = 0.3 + + var x, + min = Math.min(d,o), + max = Math.max(d,o) - var x for (var i = 1;i < this.rangeKeys.length - 1;i++) { - x = this.percentToCoord(this.rangeKeys[i]) + x = Math.round(this.percentToCoord(this.rangeKeys[i])) + 0.5 * PXSCALE + if (x < max && x > min) { + this.ctx.strokeStyle = this.colors.gauge + + } else { + this.ctx.strokeStyle = this.colors.track + } this.ctx.beginPath() this.ctx.moveTo(x, 0) this.ctx.lineTo(x, this.height) @@ -181,8 +188,8 @@ Fader.prototype.draw = function(){ this.ctx.lineTo(o, this.height / 2) this.ctx.lineWidth = this.height this.ctx.stroke() - this.ctx.globalAlpha = 1 + this.ctx.globalAlpha = 1 this.ctx.beginPath() this.ctx.fillStyle = this.colors.knob this.ctx.rect(Math.min(d,this.width-PXSCALE), 0, PXSCALE, this.height) @@ -222,12 +229,19 @@ Fader.prototype.draw = function(){ if (!this.widgetData.noPip) { this.ctx.lineWidth = PXSCALE - this.ctx.strokeStyle = this.colors.text - this.ctx.globalAlpha = 0.05 + this.ctx.globalAlpha = 0.3 + + var y, + min = Math.min(d,o), + max = Math.max(d,o) - var y for (var i = 1;i < this.rangeKeys.length - 1;i++) { - y = this.percentToCoord(this.rangeKeys[i]) + y = Math.round(this.percentToCoord(this.rangeKeys[i])) + 0.5 * PXSCALE + if (y < max && y > min) { + this.ctx.strokeStyle = this.colors.gauge + } else { + this.ctx.strokeStyle = this.colors.track + } this.ctx.beginPath() this.ctx.moveTo(0, y) this.ctx.lineTo(this.width, y) @@ -235,7 +249,6 @@ Fader.prototype.draw = function(){ } } - this.ctx.globalAlpha = 0.3 this.ctx.strokeStyle = this.colors.gauge this.ctx.beginPath() @@ -243,8 +256,8 @@ Fader.prototype.draw = function(){ this.ctx.lineTo(this.width / 2, o) this.ctx.lineWidth = this.width this.ctx.stroke() - this.ctx.globalAlpha = 1 + this.ctx.globalAlpha = 1 this.ctx.beginPath() this.ctx.fillStyle = this.colors.knob this.ctx.rect(0, Math.min(d, this.height - PXSCALE), this.width, PXSCALE) diff --git a/src/browser/js/jquery/jquery.drag.js b/src/browser/js/jquery/jquery.drag.js index a8422d59..5e6d1321 100644 --- a/src/browser/js/jquery/jquery.drag.js +++ b/src/browser/js/jquery/jquery.drag.js @@ -167,6 +167,11 @@ if (isNaN(i)) continue + if (oE.targetTouches[j].target.length > 1) { + //"é" + } + + var touch = oE.changedTouches[i], id = touch.identifier