Merge branch 'master' of github.com:jean-emmanuel/open-stage-control
This commit is contained in:
commit
590625dd11
20 changed files with 85 additions and 84 deletions
|
|
@ -176,7 +176,7 @@ var incrementWidget = function(data, root){
|
|||
data.address = 'auto'
|
||||
|
||||
} else if (address !== 'auto') {
|
||||
|
||||
|
||||
var addressref
|
||||
while (fakeStore.address.indexOf(address) != -1 || widgetManager.getWidgetByAddress(addressref).length) {
|
||||
address = address.replace(/([0-9]*)$/,function(m){
|
||||
|
|
|
|||
|
|
@ -80,6 +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.'},
|
||||
padding: {type: 'number', value: 'auto', help: 'Inner spacing.'},
|
||||
|
||||
|
||||
|
|
@ -1038,6 +1039,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: '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)},
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ module.exports = class Image extends StaticProperties(Widget, {bypass: true}) {
|
|||
|
||||
setValue(v, options={}) {
|
||||
|
||||
if (typeof this.value !== 'string') return
|
||||
|
||||
var s = v==null ? '' : '' + v,
|
||||
cache_query = ''
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
var margin = this.cssVars.padding + this.cssVars.strokeWidth
|
||||
|
||||
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 + PXSCALE,
|
||||
padding = this.cssVars.padding + this.cssVars.strokeWidth,
|
||||
decimals = this.getProp('smooth') ? 1 : 0,
|
||||
length = this.value.length,
|
||||
x, y, i, previousValue, nx, ny
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class Pad extends Canvas {
|
|||
super.cacheCanvasStyle(style)
|
||||
|
||||
this.pointSize = parseFloat(style.getPropertyValue('--pointSize')) * PXSCALE
|
||||
this.padPadding = (this.cssVars.padding + PXSCALE)
|
||||
this.padPadding = (this.cssVars.padding + this.cssVars.strokeWidth)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 - PXSCALE,
|
||||
maxRadius = this.minDimension / 2 - this.cssVars.strokeWidth,
|
||||
gaugeWidth = maxRadius - minRadius,
|
||||
gaugeRadius = maxRadius - gaugeWidth / 2
|
||||
|
||||
|
|
@ -245,20 +245,23 @@ module.exports = class Encoder extends StaticProperties(Knob, {angle: 360, range
|
|||
}
|
||||
|
||||
// stroke
|
||||
if (this.cssVars.strokeWidth) {
|
||||
|
||||
this.ctx.globalAlpha = this.cssVars.alphaStroke
|
||||
this.ctx.strokeStyle = this.cssVars.colorStroke
|
||||
this.ctx.lineWidth = PXSCALE
|
||||
this.ctx.globalAlpha = this.cssVars.alphaStroke
|
||||
this.ctx.strokeStyle = this.cssVars.colorStroke
|
||||
this.ctx.lineWidth = this.cssVars.strokeWidth
|
||||
|
||||
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.arc(this.width / 2, this.height / 2, maxRadius, 0, 2 * Math.PI)
|
||||
this.ctx.stroke()
|
||||
|
||||
}
|
||||
|
||||
this.ctx.beginPath()
|
||||
this.ctx.arc(this.width / 2, this.height / 2, maxRadius, 0, 2 * Math.PI)
|
||||
this.ctx.stroke()
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ class Fader extends Slider {
|
|||
super.dragHandle(...arguments)
|
||||
|
||||
var padding = this.gaugePadding
|
||||
if (this.getProp('design') === 'compact') padding += this.cssVars.knobSize * PXSCALE / 2
|
||||
if (this.getProp('design') === 'compact') padding += this.cssVars.knobSize / 2
|
||||
|
||||
this.percent = this.getProp('horizontal')?
|
||||
this.percent + ( e.movementX / (this.width - padding * 2)) * 100 / e.inertia * this.getProp('sensitivity'):
|
||||
|
|
@ -235,18 +235,21 @@ class Fader extends Slider {
|
|||
if (compact) {
|
||||
|
||||
// stroke
|
||||
if (this.cssVars.strokeWidth) {
|
||||
|
||||
this.ctx.globalAlpha = this.cssVars.alphaStroke
|
||||
this.ctx.strokeStyle = this.cssVars.colorStroke
|
||||
this.ctx.globalAlpha = this.cssVars.alphaStroke
|
||||
this.ctx.strokeStyle = this.cssVars.colorStroke
|
||||
|
||||
this.ctx.beginPath()
|
||||
this.ctx.moveTo(0, 0)
|
||||
this.ctx.lineTo(width, 0)
|
||||
this.ctx.lineTo(width, height)
|
||||
this.ctx.lineTo(0, height)
|
||||
this.ctx.closePath()
|
||||
this.ctx.lineWidth = 2 * PXSCALE
|
||||
this.ctx.stroke()
|
||||
this.ctx.beginPath()
|
||||
this.ctx.moveTo(0, 0)
|
||||
this.ctx.lineTo(width, 0)
|
||||
this.ctx.lineTo(width, height)
|
||||
this.ctx.lineTo(0, height)
|
||||
this.ctx.closePath()
|
||||
this.ctx.lineWidth = 2 * this.cssVars.strokeWidth
|
||||
this.ctx.stroke()
|
||||
|
||||
}
|
||||
|
||||
|
||||
// flat knob
|
||||
|
|
|
|||
|
|
@ -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 : PXSCALE),
|
||||
maxRadius = this.minDimension / 2 - (pips ? this.fontSize * 2 : PXSCALE)
|
||||
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
|
||||
|
||||
if (dashed) dashed = Array.isArray(dashed) ? dashed.map(x=>parseFloat(x)) : [1.5, 1.5]
|
||||
|
||||
|
|
@ -218,14 +218,15 @@ module.exports = class Knob extends Slider {
|
|||
|
||||
|
||||
// stroke
|
||||
if (this.cssVars.strokeWidth) {
|
||||
this.ctx.globalAlpha = this.cssVars.alphaStroke
|
||||
this.ctx.strokeStyle = this.cssVars.colorStroke
|
||||
this.ctx.lineWidth = this.cssVars.strokeWidth
|
||||
|
||||
this.ctx.globalAlpha = this.cssVars.alphaStroke
|
||||
this.ctx.strokeStyle = this.cssVars.colorStroke
|
||||
this.ctx.lineWidth = PXSCALE
|
||||
|
||||
this.ctx.beginPath()
|
||||
this.ctx.arc(this.width / 2, this.height / 2, maxRadius, 0, 2 * Math.PI)
|
||||
this.ctx.stroke()
|
||||
this.ctx.beginPath()
|
||||
this.ctx.arc(this.width / 2, this.height / 2, maxRadius, 0, 2 * Math.PI)
|
||||
this.ctx.stroke()
|
||||
}
|
||||
|
||||
|
||||
// knob
|
||||
|
|
|
|||
|
|
@ -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 * PXSCALE
|
||||
this.ctx.lineWidth = 2 * this.cssVars.strokeWidth
|
||||
this.ctx.stroke()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ class Slider extends Canvas {
|
|||
|
||||
super.cacheCanvasStyle(style)
|
||||
|
||||
this.gaugePadding = this.cssVars.padding + PXSCALE
|
||||
this.gaugePadding = this.cssVars.padding + this.cssVars.strokeWidth
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
&:before {
|
||||
content:"";
|
||||
position: absolute;
|
||||
border: 1rem solid var(--color-stroke);
|
||||
border: var(--stroke-width) solid var(--color-stroke);
|
||||
opacity: var(--alpha-stroke);
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
|
@ -20,10 +20,10 @@
|
|||
position: absolute;
|
||||
background: var(--color-fill);
|
||||
opacity: var(--alpha-fill);
|
||||
top: 1rem;
|
||||
left: 1rem;
|
||||
right: 1rem;
|
||||
bottom: 1rem;
|
||||
top: var(--stroke-width);
|
||||
left: var(--stroke-width);
|
||||
right: var(--stroke-width);
|
||||
bottom: var(--stroke-width);
|
||||
pointer-events: none;
|
||||
margin: var(--widget-padding);
|
||||
z-index: $z;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ $font-menu: sans-serif;
|
|||
--color-context-menu-text: #{$nord1};
|
||||
|
||||
|
||||
--stroke-width: 1rem;
|
||||
|
||||
--alpha-scrollbar: 0.25;
|
||||
--alpha-scrollbar-on: 0.75;
|
||||
--scrollbar-size: 12rem;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
// transform-origin: top left;
|
||||
|
||||
--stroke-width: 1rem;
|
||||
--widget-padding: 1rem;
|
||||
|
||||
--color-stroke:var(--color-widget);
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
--widget-spacing: calc(var(--widget-padding) / 2);
|
||||
margin: calc(var(--widget-spacing) + 1rem);
|
||||
margin: calc(var(--widget-spacing) + var(--stroke-width));
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -125,6 +125,7 @@
|
|||
overflow: hidden;
|
||||
@include pseudo-fill($z: -1);
|
||||
&:after {
|
||||
--stroke-width: 1rem;
|
||||
margin: calc(var(--widget-spacing) - 1rem);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@
|
|||
&.contains-widgets {
|
||||
|
||||
> inner {
|
||||
margin: calc(var(--widget-spacing) + 1rem);
|
||||
margin: calc(var(--widget-spacing) + var(--stroke-width));
|
||||
}
|
||||
|
||||
&.no-inner-padding > inner {
|
||||
|
|
@ -533,6 +533,7 @@
|
|||
.patchbaynode-container {
|
||||
|
||||
justify-content: center;
|
||||
background: transparent;
|
||||
|
||||
}
|
||||
.patchbay-container {
|
||||
|
|
@ -555,21 +556,23 @@
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items:stretch;
|
||||
margin-bottom: 1rem;
|
||||
margin-bottom: var(--stroke-width);
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.inputs, .outputs {
|
||||
position: relative;
|
||||
@include pseudo-stroke();
|
||||
top: 1rem;
|
||||
top: var(--stroke-width);
|
||||
margin-top: -1rem;
|
||||
height: calc(100% - var(--stroke-width) * 2 + 2rem);
|
||||
}
|
||||
|
||||
.inputs:before {
|
||||
border-width: 0 1rem 0 0;
|
||||
border-width: 0 var(--stroke-width) 0 0;
|
||||
}
|
||||
.outputs:before {
|
||||
border-width: 0 0 0 1rem;
|
||||
border-width: 0 0 0 var(--stroke-width);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
--widget-spacing: calc(var(--widget-padding) / 2);
|
||||
|
||||
padding: var(--widget-spacing);
|
||||
padding: calc(var(--stroke-width) + var(--widget-spacing));
|
||||
|
||||
grid-template:
|
||||
"a a b" auto / 1fr;
|
||||
|
|
@ -70,6 +70,7 @@
|
|||
width: auto;
|
||||
margin: var(--widget-spacing);
|
||||
--widget-padding: 2rem;
|
||||
--stroke-width: 0;
|
||||
}
|
||||
|
||||
.pad {
|
||||
|
|
@ -98,7 +99,7 @@
|
|||
--alpha-fill-off: 0.5;
|
||||
--alpha-fill-on: 0;
|
||||
--alpha-stroke: 0;
|
||||
--widget-padding: -1rem;
|
||||
--widget-padding: 0rem;
|
||||
|
||||
&:after {
|
||||
content:"";
|
||||
|
|
@ -120,7 +121,7 @@
|
|||
--alpha-stroke: 0;
|
||||
--alpha-fill-off: 0.1;
|
||||
--alpha-fill-on: 0.25;
|
||||
--widget-padding: -1rem;
|
||||
--widget-padding: 0rem;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,31 +7,19 @@ module.exports = {
|
|||
'Targets must be ip:port or hostname:port pairs (port must be >= 1024) or midi:port_name pairs' : true
|
||||
}
|
||||
},
|
||||
'l': {alias: 'load', type: 'string', file: {name: 'OSC Session (.json)', extensions: ['json', 'js']}, describe: 'session file to load',
|
||||
'l': {alias: 'load', type: 'string', file: {name: 'OSC Session (.json)', extensions: ['json']}, describe: 'session file to load (.json)',
|
||||
check: (arg)=>{
|
||||
return fs.existsSync(arg) ? true : 'Session file not found: ' + arg
|
||||
}
|
||||
},
|
||||
'state': {type: 'string', file: {name: 'OSC State (.state)', extensions: ['state']}, describe: 'state file to load',
|
||||
'state': {type: 'string', file: {name: 'OSC State (.state)', extensions: ['state']}, describe: 'state file to load (.state)',
|
||||
check: (arg)=>{
|
||||
return fs.existsSync(arg) ? true : 'State file not found: ' + arg
|
||||
}
|
||||
},
|
||||
'c': {alias: 'custom-module', type: 'array', file: {name: 'OSC Custom module (.js)', extensions: ['js']}, describe: 'custom module file to load (custom options can be passed after the filename)',
|
||||
'c': {alias: 'custom-module', type: 'string', file: {name: 'OSC Custom module (.js)', extensions: ['js']}, describe: 'custom module file to load (.js)',
|
||||
check: (arg)=>{
|
||||
|
||||
var customModule = arg.slice()
|
||||
|
||||
// consolidate path containing whitespaces
|
||||
if (!customModule[0].includes('.js')) {
|
||||
var index = customModule.findIndex(x => typeof x === 'string' && x.includes('.js'))
|
||||
if (index !== undefined) {
|
||||
var _path = customModule.slice(0, index + 1).join(' ')
|
||||
customModule.splice(0, index + 1, _path)
|
||||
}
|
||||
}
|
||||
|
||||
return fs.existsSync(customModule[0]) ? true : 'Custom module file not found: ' + customModule[0]
|
||||
return fs.existsSync(arg) ? true : 'Custom module file not found: ' + arg
|
||||
},
|
||||
},
|
||||
'p': {alias: 'port', type: 'number', describe: 'http port of the server (default to 8080)',
|
||||
|
|
|
|||
|
|
@ -21,22 +21,14 @@ class OscServer {
|
|||
this.customModule = (()=>{
|
||||
|
||||
var customModule = settings.read('custom-module')
|
||||
if (!customModule) return false
|
||||
|
||||
// consolidate path containing whitespaces
|
||||
if (!customModule[0].includes('.js')) {
|
||||
var index = customModule.findIndex(x => typeof x === 'string' && x.includes('.js'))
|
||||
if (index !== undefined) {
|
||||
var _path = customModule.slice(0, index + 1).join(' ')
|
||||
customModule.splice(0, index + 1, _path)
|
||||
}
|
||||
}
|
||||
if (!customModule) return false
|
||||
|
||||
var file = (()=>{
|
||||
try {
|
||||
return fs.readFileSync(customModule[0], 'utf8')
|
||||
return fs.readFileSync(customModule, 'utf8')
|
||||
} catch(err) {
|
||||
console.error('(ERROR) Custom module not found: ' + customModule[0])
|
||||
console.error('(ERROR) Custom module not found: ' + customModule)
|
||||
return false
|
||||
}
|
||||
})(),
|
||||
|
|
@ -66,7 +58,7 @@ class OscServer {
|
|||
loadJSON: (url)=>{
|
||||
if (url.split('.').pop() === 'json') {
|
||||
try {
|
||||
url = path.resolve(path.dirname(customModule[0]), url)
|
||||
url = path.resolve(path.dirname(customModule), url)
|
||||
return JSON.parse(fs.readFileSync(url, 'utf8'))
|
||||
} catch(e) {
|
||||
console.error('(ERROR) could not load json file from ' + url)
|
||||
|
|
@ -78,7 +70,7 @@ class OscServer {
|
|||
},
|
||||
saveJSON: (url, data)=>{
|
||||
if (url.split('.').pop() === 'json') {
|
||||
url = path.resolve(path.dirname(customModule[0]), url)
|
||||
url = path.resolve(path.dirname(customModule), url)
|
||||
try {
|
||||
return fs.writeFileSync(url, JSON.stringify(data, null, ' '))
|
||||
} catch(e) {
|
||||
|
|
@ -93,7 +85,6 @@ class OscServer {
|
|||
setTimeout, clearTimeout,
|
||||
setInterval, clearInterval,
|
||||
settings,
|
||||
options: customModule.slice(1, customModule.length),
|
||||
module: {},
|
||||
})
|
||||
|
||||
|
|
@ -103,7 +94,7 @@ class OscServer {
|
|||
process.mainModule.require = process.dlopen = null
|
||||
// run
|
||||
mod = vm.runInContext(file, context, {
|
||||
filename: customModule[0]
|
||||
filename: customModule
|
||||
})
|
||||
if (context.module.exports) mod = context.module.exports
|
||||
} catch(err) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue