widgets: rename strokeWidth -> lineWidth
knob: use lineWidth in all designs
This commit is contained in:
parent
c91d9af45d
commit
24a194aa9d
19 changed files with 59 additions and 58 deletions
|
|
@ -151,7 +151,7 @@ class Canvas extends Widget {
|
|||
},10)
|
||||
return
|
||||
case 'css':
|
||||
case 'strokeWidth':
|
||||
case 'lineWidth':
|
||||
case 'padding':
|
||||
resize.check(this.canvas, true)
|
||||
setTimeout(()=>{
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class Widget extends EventEmitter {
|
|||
alphaFillOff: {type: 'number', value: 'auto', help: 'Fill color opacity (off).'},
|
||||
alphaFillOn: {type: 'number', value: 'auto', help: 'Fill color opacity (on).'},
|
||||
|
||||
strokeWidth: {type: 'number', value: 'auto', help: 'Stroke width.'},
|
||||
lineWidth: {type: 'number', value: 'auto', help: 'Stroke width.'},
|
||||
padding: {type: 'number', value: 'auto', help: 'Inner spacing.'},
|
||||
|
||||
|
||||
|
|
@ -818,7 +818,7 @@ class Widget extends EventEmitter {
|
|||
case 'alphaStroke':
|
||||
case 'alphaFillOff':
|
||||
case 'alphaFillOn':
|
||||
case 'strokeWidth':
|
||||
case 'lineWidth':
|
||||
case 'padding':
|
||||
this.setCssVariables()
|
||||
return
|
||||
|
|
@ -1040,7 +1040,7 @@ Widget.cssVariables = [
|
|||
{js: 'colorStroke', css: '--color-stroke'},
|
||||
{js: 'colorText', css: '--color-text'},
|
||||
{js: 'padding', css: '--widget-padding', toCss: x=>parseFloat(x) + 'rem', toJs: x=>parseFloat(x) * PXSCALE},
|
||||
{js: 'strokeWidth', css: '--stroke-width', toCss: x=>parseFloat(x) + 'rem', toJs: x=>parseFloat(x) * PXSCALE},
|
||||
{js: 'lineWidth', css: '--line-width', toCss: x=>parseFloat(x) + 'rem', toJs: x=>parseFloat(x) * PXSCALE},
|
||||
{js: 'alphaFillOn', css: '--alpha-fill-on', toCss: x=>parseFloat(x), toJs: x=>parseFloat(x)},
|
||||
{js: 'alphaFillOff', css: '--alpha-fill-off', toCss: x=>parseFloat(x), toJs: x=>parseFloat(x)},
|
||||
{js: 'alphaStroke', css: '--alpha-stroke', toCss: x=>parseFloat(x), toJs: x=>parseFloat(x)},
|
||||
|
|
@ -1065,7 +1065,7 @@ Widget.dynamicProps = [
|
|||
'alphaFillOff',
|
||||
'alphaFillOn',
|
||||
'padding',
|
||||
'strokeWidth',
|
||||
'lineWidth',
|
||||
'css',
|
||||
|
||||
'value',
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Clone extends Container() {
|
|||
props: {type: 'object', value: {}, help: 'Cloned widget\'s properties to override'},
|
||||
|
||||
}, [
|
||||
'colorBg', 'colorText', 'colorWidget', 'colorFill', 'colorStroke', 'alphaStroke', 'alphaFillOff', 'alphaFillOn', 'padding', 'strokeWidth',
|
||||
'colorBg', 'colorText', 'colorWidget', 'colorFill', 'colorStroke', 'alphaStroke', 'alphaFillOff', 'alphaFillOn', 'padding', 'lineWidth',
|
||||
'label', 'color',
|
||||
'_value', 'default', 'value', 'script', 'linkId',
|
||||
'_osc', 'decimals', 'address', 'preArgs', 'typeTags', 'target', 'ignoreDefaults', 'bypass'
|
||||
|
|
@ -298,7 +298,7 @@ class Clone extends Container() {
|
|||
case 'alphaFillOff':
|
||||
case 'alphaFillOn':
|
||||
case 'colorBg':
|
||||
case 'strokeWidth':
|
||||
case 'lineWidth':
|
||||
case 'padding':
|
||||
for (var w of this.children) {
|
||||
if (w) w.onPropChanged(propName)
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ module.exports = class Plot extends StaticProperties(Canvas, {bypass: true, inte
|
|||
this.ctx.fillStyle = this.cssVars.colorText
|
||||
this.ctx.globalAlpha = this.cssVars.alphaPips
|
||||
|
||||
var margin = this.cssVars.padding + this.cssVars.strokeWidth
|
||||
var margin = this.cssVars.padding + this.cssVars.lineWidth
|
||||
|
||||
if (margin < this.fontSize * 1.5) return
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ module.exports = class Plot extends StaticProperties(Canvas, {bypass: true, inte
|
|||
draw_line() {
|
||||
|
||||
var points = [],
|
||||
padding = this.cssVars.padding + this.cssVars.strokeWidth,
|
||||
padding = this.cssVars.padding + this.cssVars.lineWidth,
|
||||
decimals = this.getProp('smooth') ? 1 : 0,
|
||||
length = this.value.length,
|
||||
x, y, i, previousValue, nx, ny
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ module.exports = class MultiXy extends Pad {
|
|||
case 'alphaFillOff':
|
||||
case 'alphaFillOn':
|
||||
case 'padding':
|
||||
case 'strokeWidth':
|
||||
case 'lineWidth':
|
||||
for (var w of this.pads) {
|
||||
w.onPropChanged(propName)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class Pad extends Canvas {
|
|||
super.cacheCanvasStyle(style)
|
||||
|
||||
this.pointSize = parseFloat(style.getPropertyValue('--pointSize')) * PXSCALE
|
||||
this.padPadding = (this.cssVars.padding + this.cssVars.strokeWidth) + 2 * PXSCALE
|
||||
this.padPadding = (this.cssVars.padding + this.cssVars.lineWidth) + 2 * PXSCALE
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ module.exports = class Encoder extends StaticProperties(Knob, {angle: 360, range
|
|||
min = this.percentToAngle(0),
|
||||
max = this.percentToAngle(100),
|
||||
minRadius = this.minDimension / 6,
|
||||
maxRadius = this.minDimension / 2 - this.cssVars.strokeWidth,
|
||||
maxRadius = this.minDimension / 2 - this.cssVars.lineWidth,
|
||||
gaugeWidth = maxRadius - minRadius,
|
||||
gaugeRadius = maxRadius - gaugeWidth / 2
|
||||
|
||||
|
|
@ -245,11 +245,11 @@ module.exports = class Encoder extends StaticProperties(Knob, {angle: 360, range
|
|||
}
|
||||
|
||||
// stroke
|
||||
if (this.cssVars.strokeWidth) {
|
||||
if (this.cssVars.lineWidth) {
|
||||
|
||||
this.ctx.globalAlpha = this.cssVars.alphaStroke
|
||||
this.ctx.strokeStyle = this.cssVars.colorStroke
|
||||
this.ctx.lineWidth = this.cssVars.strokeWidth
|
||||
this.ctx.lineWidth = this.cssVars.lineWidth
|
||||
|
||||
if (this.minDimension > 40) {
|
||||
this.ctx.beginPath()
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ class Fader extends Slider {
|
|||
if (compact) {
|
||||
|
||||
// stroke
|
||||
if (this.cssVars.strokeWidth) {
|
||||
if (this.cssVars.lineWidth) {
|
||||
|
||||
this.ctx.globalAlpha = this.cssVars.alphaStroke
|
||||
this.ctx.strokeStyle = this.cssVars.colorStroke
|
||||
|
|
@ -246,7 +246,7 @@ class Fader extends Slider {
|
|||
this.ctx.lineTo(width, height)
|
||||
this.ctx.lineTo(0, height)
|
||||
this.ctx.closePath()
|
||||
this.ctx.lineWidth = 2 * this.cssVars.strokeWidth
|
||||
this.ctx.lineWidth = 2 * this.cssVars.lineWidth
|
||||
this.ctx.stroke()
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,8 +176,8 @@ module.exports = class Knob extends Slider {
|
|||
max = this.percentToAngle(100),
|
||||
dashed = this.getProp('dashed'),
|
||||
pips = this.getProp('pips'),
|
||||
minRadius = this.minDimension / 6 - (pips ? this.fontSize * 0.75 : 0) - this.cssVars.strokeWidth / 2,
|
||||
maxRadius = this.minDimension / 2 - (pips ? this.fontSize * 2 : 0) - this.cssVars.strokeWidth / 2
|
||||
minRadius = this.minDimension / 6 - (pips ? this.fontSize * 0.75 : 0) - this.cssVars.lineWidth / 2,
|
||||
maxRadius = this.minDimension / 2 - (pips ? this.fontSize * 2 : 0) - this.cssVars.lineWidth / 2
|
||||
|
||||
if (dashed) dashed = Array.isArray(dashed) ? dashed.map(x=>parseFloat(x)) : [1.5, 1.5]
|
||||
|
||||
|
|
@ -218,10 +218,10 @@ module.exports = class Knob extends Slider {
|
|||
|
||||
|
||||
// stroke
|
||||
if (this.cssVars.strokeWidth) {
|
||||
if (this.cssVars.lineWidth) {
|
||||
this.ctx.globalAlpha = this.cssVars.alphaStroke
|
||||
this.ctx.strokeStyle = this.cssVars.colorStroke
|
||||
this.ctx.lineWidth = this.cssVars.strokeWidth
|
||||
this.ctx.lineWidth = this.cssVars.lineWidth
|
||||
|
||||
this.ctx.beginPath()
|
||||
this.ctx.arc(this.width / 2, this.height / 2, maxRadius, 0, 2 * Math.PI)
|
||||
|
|
@ -233,7 +233,7 @@ module.exports = class Knob extends Slider {
|
|||
|
||||
this.ctx.globalAlpha = 1
|
||||
this.ctx.strokeStyle = this.cssVars.colorFill
|
||||
this.ctx.lineWidth = 2.5 * PXSCALE
|
||||
this.ctx.lineWidth = this.cssVars.lineWidth + .5 * PXSCALE
|
||||
|
||||
let r1 = minRadius + this.gaugePadding,
|
||||
r2 = maxRadius - this.gaugePadding,
|
||||
|
|
@ -257,7 +257,7 @@ module.exports = class Knob extends Slider {
|
|||
|
||||
// fill
|
||||
this.ctx.strokeStyle = this.cssVars.colorFill
|
||||
this.ctx.lineWidth = 2 * PXSCALE
|
||||
this.ctx.lineWidth = this.cssVars.lineWidth
|
||||
|
||||
if (this.cssVars.alphaFillOff) {
|
||||
this.ctx.globalAlpha = this.cssVars.alphaFillOff
|
||||
|
|
@ -281,7 +281,7 @@ module.exports = class Knob extends Slider {
|
|||
|
||||
this.ctx.globalAlpha = 1
|
||||
this.ctx.strokeStyle = this.cssVars.colorBg
|
||||
this.ctx.lineWidth = 2.5 * PXSCALE
|
||||
this.ctx.lineWidth = this.cssVars.lineWidth + .5 * PXSCALE
|
||||
|
||||
let r1 = minRadius,
|
||||
r2 = maxRadius / 1.25 + PXSCALE ,
|
||||
|
|
@ -298,7 +298,7 @@ module.exports = class Knob extends Slider {
|
|||
|
||||
// fill
|
||||
this.ctx.strokeStyle = this.cssVars.colorFill
|
||||
this.ctx.lineWidth = 2 * PXSCALE
|
||||
this.ctx.lineWidth = this.cssVars.lineWidth
|
||||
|
||||
if (this.cssVars.alphaFillOff) {
|
||||
this.ctx.globalAlpha = this.cssVars.alphaFillOff
|
||||
|
|
@ -322,10 +322,10 @@ module.exports = class Knob extends Slider {
|
|||
|
||||
this.ctx.globalAlpha = 1
|
||||
this.ctx.strokeStyle = this.cssVars.colorFill
|
||||
this.ctx.lineWidth = 2.5 * PXSCALE
|
||||
this.ctx.lineWidth = this.cssVars.lineWidth
|
||||
|
||||
let r1 = minRadius * 1.5,
|
||||
r2 = maxRadius + 0.5 * PXSCALE,
|
||||
r2 = maxRadius + this.cssVars.lineWidth / 2 - 0.5 * PXSCALE,
|
||||
a = 2 * Math.PI - d
|
||||
|
||||
this.ctx.beginPath()
|
||||
|
|
@ -340,13 +340,13 @@ module.exports = class Knob extends Slider {
|
|||
|
||||
if (pips) {
|
||||
|
||||
this.ctx.lineWidth = 1.5 * PXSCALE
|
||||
this.ctx.lineWidth = this.cssVars.lineWidth / 2 + 0.5 * PXSCALE
|
||||
this.ctx.strokeStyle = this.cssVars.colorStroke
|
||||
this.ctx.globalAlpha = this.cssVars.alphaPips
|
||||
|
||||
for (var pip of this.rangeKeys) {
|
||||
|
||||
let r1 = maxRadius + 3 * PXSCALE,
|
||||
let r1 = maxRadius + this.cssVars.lineWidth / 2 + 2 * PXSCALE,
|
||||
r2 = r1 + 4 * PXSCALE,
|
||||
a = 2 * Math.PI - this.percentToAngle(pip)
|
||||
|
||||
|
|
@ -358,7 +358,7 @@ module.exports = class Knob extends Slider {
|
|||
|
||||
}
|
||||
|
||||
var radius = maxRadius + (this.fontSize + 4 * PXSCALE)
|
||||
var radius = maxRadius + (this.fontSize + this.cssVars.lineWidth / 2 + 2 * PXSCALE)
|
||||
this.ctx.fillStyle = this.cssVars.colorText
|
||||
this.ctx.globalAlpha = this.cssVars.alphaPipsText
|
||||
for (var p in this.pipTexts) {
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ class Range extends Fader {
|
|||
this.ctx.lineTo(width, height)
|
||||
this.ctx.lineTo(0, height)
|
||||
this.ctx.closePath()
|
||||
this.ctx.lineWidth = 2 * this.cssVars.strokeWidth
|
||||
this.ctx.lineWidth = 2 * this.cssVars.lineWidth
|
||||
this.ctx.stroke()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ class Slider extends Canvas {
|
|||
|
||||
super.cacheCanvasStyle(style)
|
||||
|
||||
this.gaugePadding = this.cssVars.padding + this.cssVars.strokeWidth
|
||||
this.gaugePadding = this.cssVars.padding + this.cssVars.lineWidth
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue