continue v1

This commit is contained in:
bordun 2020-02-24 14:00:59 +01:00
parent 85f7f1cb8e
commit be693864ab
25 changed files with 139 additions and 244 deletions

View file

@ -7,8 +7,6 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon" href="../assets/logo.png" />
<link rel="preload" href="../assets/fonts/fa-solid-900.woff" as="font"/>
<link rel="preload" href="../assets/fonts/roboto-medium.woff" as="font"/>
<link rel="stylesheet" type="text/css" href="../assets/open-stage-control.css" hot-reload/>
<link rel="stylesheet" type="text/css" href="../assets/theme.css" hot-reload/>
<link rel="stylesheet" type="text/css" href="../assets/fonts/fontawesome.min.css"/>

View file

@ -71,7 +71,7 @@
"yargs": "15.1.0"
},
"optionalDependencies": {
"electron": "7.1.11",
"electron": "8.0.1",
"electron-installer-debian": "3.0.0"
},
"scripts": {

View file

@ -138,7 +138,6 @@ var WidgetManager = class WidgetManager extends EventEmitter {
data: updatedData || {
precision: widget.getProp('precision'),
preArgs: widget.getProp('preArgs'),
split: widget.getSplit(),
target: widget.getProp('target'),
address: widget.getProp('address'),
noSync: widget.getProp('noSync'),

View file

@ -64,9 +64,6 @@ class Menu extends Widget {
this.parseValues()
this.parentScroll = [0,0]
if (this.getProp('doubleTap')) {
doubletab(this.widget, (e)=>{

View file

@ -54,6 +54,7 @@ class Widget extends EventEmitter {
'Insert icons using the prefix ^ followed by the icon\'s name : ^play, ^pause, etc (see https://fontawesome.com/icons?d=gallery&s=solid&m=free)'
]},
visible: {type: 'boolean', value: true, help: 'Set to `false` to hide the widget.'},
// interaction: {type: 'boolean', value: true, help: 'Set to `false` to disable pointer interactions.'},
_geometry:'geometry',
@ -174,7 +175,6 @@ class Widget extends EventEmitter {
this.errors.id = 'There can only be one root'
}
this.disabledProps = []
// this.mathjsDeprecationWarned = false
// cache precision
@ -281,8 +281,6 @@ class Widget extends EventEmitter {
}
getSplit() {}
checkLinkedProps(propNames) {
// Dynamic props cache check
@ -440,7 +438,7 @@ class Widget extends EventEmitter {
var variables = {},
defaultScope = this.constructor.parsersContexts[propName] || {},
mathscope = context || {},
jsScope = context || {},
varnumber = 999
if (typeof propValue == 'string') {
@ -548,7 +546,7 @@ class Widget extends EventEmitter {
varnumber--
variables[varname] = r
mathscope[varname] = r
jsScope[varname] = r
return varname
@ -588,7 +586,7 @@ class Widget extends EventEmitter {
varnumber--
variables[varname] = r
mathscope[varname] = r
jsScope[varname] = r
return varname
})
@ -597,12 +595,21 @@ class Widget extends EventEmitter {
propValue = propValue.replace(/#\{(?:[^{}]|\{[^{}]*\})*\}/g, (m)=>{
// one bracket nesting allowed, if we need two: #\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\}
//TODO: js one-liner
var code = m.substr(2, m.length - 3).trim()
if (!this.parsers[code]) this.parsers[code] = evaljs('return ' + code, defaultScope)
let r = this.parsers[code](jsScope)
if (r === undefined) r = ''
return typeof r !== 'string' ? JSON.stringify(r) : r
return ''
})
} catch (err) {
console.log((this.getProp('id') || this.props.id) + '.' + propName + ': #{} error:\n' + err)
var stackline = err.stack ? (err.stack.match(/>:([0-9]+):[0-9]+/) || '') : '',
line = stackline.length > 1 ? ' at line ' + (parseInt(stackline[1]) - 2) : ''
console.log((this.getProp('id') || this.props.id) + '.' + propName + ': #{} error:\n' + err + line)
}
try {
@ -610,7 +617,7 @@ class Widget extends EventEmitter {
if (!this.parsers[code]) this.parsers[code] = evaljs(code, defaultScope)
let r = this.parsers[code](mathscope)
let r = this.parsers[code](jsScope)
if (r === undefined) r = ''
@ -794,9 +801,6 @@ class Widget extends EventEmitter {
address: propName == 'address' ? oldPropValue : this.getProp('address')
}
data[propName] = this.getProp(propName)
if (propName === 'address' && this.getSplit()) {
data['split'] = this.getSplit()
}
widgetManager.registerWidget(this, data, oldData)
return
@ -931,13 +935,20 @@ class Widget extends EventEmitter {
if (styles.includes('color')) {
// color
this.container.style.setProperty('--color-widget', this.getProp('colorWidget') != 'auto' ? this.getProp('colorWidget') : '')
this.container.style.setProperty('--color-fill', this.getProp('colorFill') != 'auto' ? this.getProp('colorFill') : '')
this.container.style.setProperty('--color-stroke', this.getProp('colorStroke') != 'auto' ? this.getProp('colorStroke') : '')
this.container.style.setProperty('--alpha-stroke', this.getProp('alphaStroke') != 'auto' ? parseFloat(this.getProp('alphaStroke')) : '')
this.container.style.setProperty('--alpha-fill-on', this.getProp('alphaFillOn') != 'auto' ? parseFloat(this.getProp('alphaFillOn')) : '')
this.container.style.setProperty('--alpha-fill-off', this.getProp('alphaFillOff') != 'auto' ? parseFloat(this.getProp('alphaFillOff')) : '')
this.container.style.setProperty('--widget-padding', this.getProp('padding') != 'auto' ? parseFloat(this.getProp('padding')) + 'rem' : '')
for (var cssvar of ['color-widget', 'color-fill', 'color-stroke', 'alpha-stroke', 'alpha-fill-on', 'alpha-fill-off']) {
var val = this.getProp(cssvar.replace(/\-([a-z])/g, (a,s)=>s.toUpperCase()))
this.container.style.setProperty('--' + cssvar, val !== undefined && val != 'auto' ? val : '')
}
this.container.style.setProperty('--widget-padding', this.getProp('padding') !== undefined && this.getProp('padding') != 'auto' ? parseFloat(this.getProp('padding')) + 'rem' : '')
// this.container.style.setProperty('--color-widget', this.getProp('colorWidget') && this.getProp('colorWidget') != 'auto' ? this.getProp('colorWidget') : '')
// this.container.style.setProperty('--color-fill', this.getProp('colorFill') != 'auto' ? this.getProp('colorFill') : '')
// this.container.style.setProperty('--color-stroke', this.getProp('colorStroke') != 'auto' ? this.getProp('colorStroke') : '')
// this.container.style.setProperty('--alpha-stroke', this.getProp('alphaStroke') != 'auto' ? parseFloat(this.getProp('alphaStroke')) : '')
// this.container.style.setProperty('--alpha-fill-on', this.getProp('alphaFillOn') != 'auto' ? parseFloat(this.getProp('alphaFillOn')) : '')
// this.container.style.setProperty('--alpha-fill-off', this.getProp('alphaFillOff') != 'auto' ? parseFloat(this.getProp('alphaFillOff')) : '')
// this.container.style.setProperty('--widget-padding', this.getProp('padding') != 'auto' ? parseFloat(this.getProp('padding')) + 'rem' : '')
}

View file

@ -6,7 +6,7 @@ var Container = require('../common/container'),
{diff, diffToWidget} = require('../../editor/diff'),
html = require('nanohtml')
var excludedCloneClasses = ['widget', 'absolute-position', 'ui-resizable', 'ui-draggable', 'not-editable', 'editing']
var excludedCloneClasses = ['widget', 'absolute-position', 'not-editable', 'editing']
class Clone extends Container() {
@ -28,7 +28,12 @@ class Clone extends Container() {
props: {type: 'object', value: {}, help: 'Cloned widget\'s properties to override'},
}, ['label', 'color', 'linkId', '_value', 'default', 'value', '_osc', 'precision', 'address', 'preArgs', 'target', 'bypass'])
}, [
'_style', 'colorWidget', 'colorFill', 'colorStroke', 'alphaStroke', 'alphaFillOff', 'alphaFillOn', 'padding',
'label', 'color', 'linkId',
'_value', 'default', 'value',
'_osc', 'precision', 'address', 'preArgs', 'target', 'bypass'
])
}

View file

@ -45,8 +45,6 @@ class Modal extends Panel {
super(options)
this.disabledProps = []
this.popup = html`
<div class="popup">
<div class="popup-wrapper">
@ -104,7 +102,6 @@ class Modal extends Panel {
if (e.keyCode==27) this.setValue(0, {sync:true, send:true})
}).bind(this)
this.parentScroll = [0,0]
this.value = 0
this.init = false
this.labelChange = true
@ -134,12 +131,10 @@ class Modal extends Panel {
this.popup.classList.toggle('show', this.value)
this.container.classList.toggle('on', this.value)
this.light.classList.toggle('on', this.value)
this.bindEscKey(this.value)
if (this.init) this.fixParents()
if (this.value) {
resize.check(this.widget, true)
}
@ -167,36 +162,6 @@ class Modal extends Panel {
super.onRemove()
}
fixParents() {
var parent = this.parent,
scrollFixed = false
while (parent && parent.props && parent.getProp('type') !== 'modal') {
// scroll
if (!scrollFixed && parent.getProp('type') == 'tab') {
if (this.value) {
this.parentScroll = [parent.widget.scrollLeft, parent.widget.scrollTop]
}
parent.widget.scrollLeft = this.value ? 0 : this.parentScroll[0]
parent.widget.scrollTop = this.value ? 0 : this.parentScroll[1]
parent.widget.style.overflow = this.value ? 'hidden' : ''
scrollFixed = true
}
// stacking
parent.container.style.zIndex = this.value ? 'initial' : ''
parent.container.style.contain = this.value ? 'style size' : ''
parent = parent.parent
}
this.container.style.contain = this.value ? 'style size' : ''
}
updatePopupLabel() {
if (!this.popup) return

View file

@ -128,19 +128,6 @@ class Panel extends Container() {
}
if (this.getProp('tabs') && !this.getProp('tabs').length) {
this.disabledProps.push(
'precision', 'address', 'preArgs', 'target', 'bypass',
'value', 'default'
)
}
if (this.getProp('widgets') && !this.getProp('widgets').length) {
this.disabledProps.push(
'scroll'
)
}
if (this.getProp('traversing')) this.setTraversing()
}

View file

@ -21,9 +21,14 @@ module.exports = class _matrix_base extends Container() {
switch (propName) {
case 'color':
case 'colorWidget':
case 'colorFill':
case 'colorStroke':
case 'alphaStroke':
case 'alphaFillOff':
case 'alphaFillOn':
for (var w of this.children) {
if (w) w.onPropChanged('color')
if (w) w.onPropChanged(propName)
}
return

View file

@ -34,11 +34,6 @@ module.exports = class Keyboard extends _matrix_base {
}, ['_value', 'default', 'value'], {
split: {type: 'boolean|string', value: false, help: [
'`true`: the widget\'s index will be appended to the matrice\'s osc address',
'`false`: it will be prepended to the widget\'s preArgs',
'`string`: will be used to define the widgets\' addresses, replacing dollar signs (`$`) with their respective index (to insert the actual dollar sign, it must be escaped with a backslash (`\\$`))'
]},
css: {type: 'string', value: '', help: [
'Available CSS variables:',
'- `--color-white:color;` (white keys color)',
@ -86,20 +81,12 @@ module.exports = class Keyboard extends _matrix_base {
data.target = '@{parent.target}'
data.precision = '@{parent.precision}'
if (!this.getProp('split')) {
data.address = '@{parent.address}'
data.preArgs = `#{
a = @{parent.preArgs};
b = typeof(a) == 'string' and a == '' ? [] : typeof(a) == 'Array' ? a : [a];
concat(b, [${i}])
}`
} else if (typeof this.getProp('split') === 'string' && this.getProp('split')[0] === '/' && /[^\\]\$/.test(this.getProp('split'))) {
data.address = this.getProp('split').replace(/([^\\])(\$)/g,'$1' + i).replace(/\\\$/g, '$')
data.preArgs = '@{parent.preArgs}'
} else if (this.getProp('split')) {
data.address = '@{parent.address}/' + i
data.preArgs = '@{parent.preArgs}'
}
data.address = '@{parent.address}'
data.preArgs = `#{
a = @{parent.preArgs};
b = typeof(a) == 'string' and a == '' ? [] : typeof(a) == 'Array' ? a : [a];
concat(b, [${i}])
}`
var key = parser.parse({
data: data,

View file

@ -8,10 +8,7 @@ class PatchBayNode extends Widget {
constructor(options) {
super({...options, html: html`
<div class="node">
</div>
`})
super({...options, html: null})
this.value = []
@ -108,11 +105,11 @@ class PatchBay extends Container(Canvas) {
constructor(options) {
super({...options, html: html`
<div class="patchbay">
<inner>
<div class="nodes inputs"></div>
<canvas></canvas>
<div class="nodes outputs"></div>
</div>
</inner>
`})
this.inputs = PatchBay.normalizeArrayObject(this.getProp('inputs'))
@ -148,8 +145,8 @@ class PatchBay extends Container(Canvas) {
var outputs = DOM.get(this.widget, '.outputs')[0]
for (let k in this.outputs) {
var node = html`
<div class="widget">
<div class="label">${k}</div>
<div class="widget patchbaynode-container">
<label>${k}</label>
</div>
`
outputs.appendChild(node)
@ -265,7 +262,8 @@ class PatchBay extends Container(Canvas) {
if (this.connecting.length) {
this.ctx.beginPath()
this.ctx.fillStyle = this.colors.custom
this.ctx.fillStyle = this.cssVars.colorFill
this.ctx.globalAlpha = this.cssVars.alphaFillOn
var side = this.connecting[0] !== undefined ? 0 : 1,
cx = side === 0 ? 0 : this.width,
@ -289,10 +287,10 @@ class PatchBay extends Container(Canvas) {
}
this.ctx.strokeStyle = this.colors.custom
this.ctx.strokeStyle = this.cssVars.colorFill
this.ctx.lineWidth = 2 * PXSCALE
this.ctx.globalAlpha = strongLines.length ? this.cssVars.alphaFillOff : this.cssVars.alphaFillOn
this.ctx.globalAlpha = strongLines.length ? 0.3 : 0.7
this.ctx.beginPath()
for (i in lines) {
this.ctx.moveTo(...lines[i][0])
@ -302,7 +300,7 @@ class PatchBay extends Container(Canvas) {
if (strongLines.length) {
this.ctx.globalAlpha = 0.7
this.ctx.globalAlpha = this.cssVars.alphaFillOn
this.ctx.beginPath()
for (i in strongLines) {
if (strongLines[i] === null) continue

View file

@ -45,11 +45,6 @@ module.exports = class MultiXy extends Pad {
}, [], {
touchAddress: {type: 'string', value:'', help: 'OSC address for touched state messages: `/touchAddress [preArgs] 0/1`'},
split: {type: 'boolean|object', value: false, help: [
'Set to `true` to send separate osc messages for each point\'s x and y axis. The address will be the same as the widget\'s with `/N/x` or `/N/y` appended to it, where N is the point\'s id (or the point\'s label if points is an array)',
'Can be set as an `object` to specify a different address : `[\'/0/x\', \'/0/y\', \'/1/x\', \'/2/y\']`',
'Note: the widget will only respond to its original osc address, not to the splitted version'
]},
})
@ -247,25 +242,6 @@ module.exports = class MultiXy extends Pad {
}
getSplit() {
return this.getProp('split')?
typeof this.getProp('split') == 'object' && this.getProp('split').length == 2 * this.npoints ?
this.getProp('split')
: (()=>{
var s={},
t
for (var i=0; i<this.npoints * 2;i=i+2) {
t = this.labels ? this.getProp('points')[i/2] : i/2
s[i]=this.getProp('address') + '/' + t + '/x'
s[i+1]=this.getProp('address') + '/' + t + '/y'
}
return s
})()
: false
}
onPropChanged(propName, options, oldPropValue) {
if (super.onPropChanged(...arguments)) return true

View file

@ -33,11 +33,6 @@ module.exports = class Rgb extends Pad {
}, ['color'], {
split: {type: 'boolean|object', value: false, help: [
'Set to `true` to send separate osc messages for for r and g & b. The address will be the same as the widget\'s with `/r`, `/g` or `/b` appended to it',
'Can be set as an `object` to specify a different address : `[\'/r\', \'/g\', \'b\']`',
'Note: the widget will only respond to its original osc address, not to the splitted version'
]}
})
}

View file

@ -46,11 +46,6 @@ module.exports = class Xy extends Pad {
}, [], {
touchAddress: {type: 'string', value:'', help: 'OSC address for touched state messages: `/touchAddress [preArgs] 0/1`)'},
split: {type: 'boolean|object', value: false, help: [
'Set to `true` to send separate osc messages for each point\'s x and y axis. The address will be the same as the widget\'s with `/x` or `/y` appended to it',
'Can be set as an `object` to specify a different address : [\'/osc_address_x\', \'/osc_address_y\']',
'Note: the widget will only respond to its original osc address, not to the splitted version'
]},
})
@ -282,16 +277,6 @@ module.exports = class Xy extends Pad {
}
getSplit() {
return this.getProp('split')?
typeof this.getProp('split') == 'object' && this.getProp('split').length == 2 ?
this.getProp('split')
: [this.getProp('address') + '/x', this.getProp('address') + '/y']
: false
}
onRemove() {

View file

@ -117,8 +117,6 @@ module.exports = class Fader extends Slider {
(e.offsetX - this.gaugePadding) / (this.width - this.gaugePadding * 2) * 100:
(this.height - e.offsetY - this.gaugePadding) / (this.height - this.gaugePadding * 2) * 100
// this.percent = clip(this.percent,[0,100])
this.setValue(this.percentToValue(this.percent), {send: true, sync: true, dragged: true})
}
@ -149,10 +147,6 @@ module.exports = class Fader extends Slider {
var ratio = CANVAS_SCALING * this.scaling
// if (this.getProp('compact') && this.getProp('horizontal')) {
// event.height = 1 / ratio
// }
super.resizeHandle(event)
if (this.getProp('horizontal')){

View file

@ -15,7 +15,7 @@ module.exports = class Knob extends Slider {
_knob:'knob',
mode: {type: 'string', value: 'circular', choices: ['circular', 'snap', 'vertical'], help: [
mode: {type: 'string', value: 'vertical', choices: ['vertical', 'circular', 'snap'], help: [
'- `circular`: relative move in circular motion',
'- `snap`: snap to touch position and move in vertical motion',
'- `vertical`: relative move in vertical motion',

View file

@ -190,16 +190,6 @@ class Range extends Fader {
}
getSplit() {
return this.getProp('split')?
typeof this.getProp('split') == 'object' && this.getProp('split').length == 2 ?
this.getProp('split')
: [this.getProp('address') + '/low', this.getProp('address') + '/high']
: false
}
draw() {

View file

@ -9,7 +9,6 @@
align-items:center;
justify-content: center;
z-index: 99999999;
transform: translate3d(0,0,0);
display: none;
// backdrop-filter: blur(1rem); // perf hit

View file

@ -1,38 +0,0 @@
.patchbay-container {
width: 200rem;
height: 200rem;
.patchbay {
display: flex;
flex-direction: row;
padding:1rem 2rem 1rem 1rem;
// @extend .glass-effect;
height: 100%;
canvas {
flex: 1;
width: 0;
background: var(--color-track);
border-top:1rem solid var(--color-bg);
border-bottom:1rem solid var(--color-bg)
}
.nodes {
display: flex;
flex-direction: column;
align-items:stretch;
margin-bottom: 1rem;
width: 25%;
> div {
width: 100%!important;
height: 100%;
flex:1;
flex-shrink: 0;
@extend .toggle-container;
div {
pointer-events: none;
}
}
}
}
}

View file

@ -12,7 +12,7 @@
width: 100rem;
height: 100rem;
contain: style size layout;
contain: strict;
-webkit-tap-highlight-color:transparent;
--widget-padding: 1rem;
@ -77,3 +77,4 @@
@import 'widgets/plots';
@import 'widgets/indicators';
@import 'widgets/frames';
@import 'widgets/patchbay';

View file

@ -97,12 +97,20 @@
border-radius: 0!important; // border radius breaks it somehow
z-index: initial!important;
contain: style size;
// contain: style size;
--size: 300rem;
--grid-columns: 2;
overflow: hidden;
&.on {
z-index: 9999999999999!important;
contain: layout;
overflow: visible;
}
inner {
flex:1;
display: flex;
@ -161,8 +169,8 @@
border-radius: 100%;
width:var(--size);
height:var(--size);
margin-left: calc(var(--x) - var(--size) / 2);
margin-top: calc(var(--y) - var(--size) / 2);
margin-left: calc(- var(--size) / 2);
margin-top: calc(- var(--size) / 2);
&:after {
content:"";

View file

@ -8,8 +8,6 @@
background-color: var(--color-foreground);
> .panel {
transform: rotateZ(0);
flex: 1;
flex-direction: column;
display: flex;
@ -123,11 +121,6 @@
display: none;
}
&.contains-widgets > .panel {
transform: rotateZ(0);
}
}
.panel-container {
@ -354,6 +347,10 @@
}
&.on {
z-index: 9999999999999!important;
contain: size;
overflow: visible;
border-radius: 0!important; // border radius breaks it somehow
> .toggle {
--alpha-fill:var(--alpha-fill-on);
}
@ -382,10 +379,11 @@
height: var(--height, 100%);
display: flex;
.popup-content {
// contain:unset; // == no restrain
&:before {
content: none;
}
// margin: -1rem;
> .panel {
margin: calc(var(--widget-spacing) / 2) calc(var(--widget-spacing) / 2) calc(var(--widget-spacing) / 2);
}
@ -407,12 +405,4 @@
}
&.on {
z-index: initial;
> .toggle:after {
color:var(--color-custom);
}
border-radius: 0!important; // border radius breaks it somehow
}
}

View file

@ -1,5 +1,6 @@
.xy-container, .multixy-container {
--alpha-fill-off: 0.05;
--alpha-fill: var(--alpha-fill-off);
--widget-padding: 20rem;
@ -10,11 +11,9 @@
@include pseudo-fill($z: -1);
@include pseudo-stroke();
// padding: var(--widget-padding);
}
canvas {
// margin: var(--widget-padding);
width: 100%;
text-align: center;
}

View file

@ -0,0 +1,54 @@
.patchbaynode-container {
justify-content: center;
label {
flex: 1;
pointer-events: none;
display: flex;
}
}
.patchbay-container {
width: 200rem;
height: 200rem;
--alpha-fill-on: .75;
--alpha-fill-off: 0.25;
inner {
display: flex;
flex-direction: row;
@include pseudo-stroke();
padding: var(--widget-padding);
canvas {
flex: 1;
width: 0;
}
.nodes {
display: flex;
flex-direction: column;
align-items:stretch;
margin-bottom: 1rem;
width: 25%;
}
.inputs, .outputs {
position: relative;
@include pseudo-stroke();
top: 1rem;
}
.inputs:before {
border-width: 0 1rem 0 0;
}
.outputs:before {
border-width: 0 0 0 1rem;
}
}
}

View file

@ -314,17 +314,7 @@ module.exports = {
if (port) {
if (data.split) {
for (var j in data.split) {
osc.send(host, port, data.split[j], data.preArgs ? data.preArgs.concat(value[j]) : [value[j]], data.precision)
}
} else {
osc.send(host, port, data.address, data.args, data.precision)
}
osc.send(host, port, data.address, data.args, data.precision)
}