widgets: various design & layout fixes
This commit is contained in:
parent
cf47d33eb0
commit
fa1696b284
4 changed files with 45 additions and 15 deletions
|
|
@ -1,14 +1,26 @@
|
|||
var Widget = require('../common/widget'),
|
||||
Canvas = require('../common/canvas'),
|
||||
Container = require('../common/container'),
|
||||
{iconify} = require('../../ui/utils'),
|
||||
parser = require('../../parser'),
|
||||
html = require('nanohtml')
|
||||
|
||||
class PatchBayNode extends Widget {
|
||||
|
||||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
label: {type: 'string', value: ''}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
constructor(options) {
|
||||
|
||||
super({...options, html: null})
|
||||
super({...options, html: html`<label></label>`})
|
||||
|
||||
this.widget.innerHTML = iconify(this.getProp('label').replace(/</g, '<').replace(/>/g, '>').replace(/\n/g,'<br/>'))
|
||||
|
||||
this.value = []
|
||||
|
||||
|
|
@ -126,12 +138,12 @@ class PatchBay extends Container(Canvas) {
|
|||
let w = parser.parse({
|
||||
data: {
|
||||
type: 'patchbaynode',
|
||||
label: k,
|
||||
id: this.getProp('id') + '/' + this.inputs[k],
|
||||
address: '@{parent.address}',
|
||||
target: '@{parent.target}',
|
||||
preArgs: this.inputs[k],
|
||||
bypass: '@{parent.bypass}',
|
||||
label: k
|
||||
|
||||
},
|
||||
parentNode: DOM.get(this.widget, '.inputs')[0],
|
||||
|
|
|
|||
|
|
@ -174,9 +174,10 @@ module.exports = class Knob extends Slider {
|
|||
max = this.percentToAngle(100),
|
||||
dashed = this.getProp('dashed'),
|
||||
pips = this.getProp('pips'),
|
||||
minRadius = this.minDimension / 6,
|
||||
maxRadius = this.minDimension / 2 - (pips ? this.fontSize * 2 : PXSCALE),
|
||||
gaugeWidth = maxRadius - minRadius,
|
||||
minRadius = this.minDimension / 6 - (pips ? this.fontSize * 0.75 : PXSCALE),
|
||||
maxRadius = this.minDimension / 2 - (pips ? this.fontSize * 2 : PXSCALE)
|
||||
|
||||
var gaugeWidth = maxRadius - minRadius,
|
||||
gaugeRadius = maxRadius - gaugeWidth / 2
|
||||
|
||||
this.clear()
|
||||
|
|
@ -217,12 +218,12 @@ module.exports = class Knob extends Slider {
|
|||
this.ctx.globalAlpha = this.cssVars.alphaStroke
|
||||
this.ctx.strokeStyle = this.cssVars.colorStroke
|
||||
this.ctx.lineWidth = PXSCALE
|
||||
|
||||
if (this.minDimension > 40) {
|
||||
this.ctx.beginPath()
|
||||
this.ctx.arc(this.width / 2, this.height / 2, minRadius, 0, 2 * Math.PI)
|
||||
this.ctx.stroke()
|
||||
}
|
||||
//
|
||||
// if (this.minDimension > 40) {
|
||||
// this.ctx.beginPath()
|
||||
// this.ctx.arc(this.width / 2, this.height / 2, minRadius, 0, 2 * Math.PI)
|
||||
// this.ctx.stroke()
|
||||
// }
|
||||
|
||||
|
||||
this.ctx.beginPath()
|
||||
|
|
@ -312,7 +313,7 @@ module.exports = class Knob extends Slider {
|
|||
|
||||
for (var pip of this.rangeKeys) {
|
||||
|
||||
let r1 = maxRadius,
|
||||
let r1 = maxRadius + 2 * PXSCALE,
|
||||
r2 = r1 + 4 * PXSCALE,
|
||||
a = 2 * Math.PI - this.percentToAngle(pip)
|
||||
|
||||
|
|
@ -324,7 +325,7 @@ module.exports = class Knob extends Slider {
|
|||
|
||||
}
|
||||
|
||||
var radius = maxRadius + (this.fontSize + 2 * PXSCALE)
|
||||
var radius = maxRadius + (this.fontSize + 4 * PXSCALE)
|
||||
this.ctx.fillStyle = this.cssVars.colorText
|
||||
this.ctx.globalAlpha = this.cssVars.alphaPipsText
|
||||
for (var p in this.pipTexts) {
|
||||
|
|
|
|||
|
|
@ -543,6 +543,21 @@
|
|||
}
|
||||
}
|
||||
|
||||
label {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
white-space: pre;
|
||||
line-height: 100%;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
word-wrap: break-word;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
border: 2rem solid transparent;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -583,6 +598,7 @@
|
|||
}
|
||||
&:after {
|
||||
background: var(--color-key-on);
|
||||
z-index: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -609,6 +625,7 @@
|
|||
inner {
|
||||
margin-left: 0!important;
|
||||
margin-right: 0!important;
|
||||
margin-bottom: 0!important;
|
||||
background: var(--color-black-key);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
.led-container {
|
||||
|
||||
width: 90rem;
|
||||
height: 60rem;
|
||||
width: 30rem;
|
||||
height: 30rem;
|
||||
|
||||
--color-led: var(--color-fill);
|
||||
--alpha-fill-off: 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue