error handling, launcher ui, read-only mode, rm plot/smooth

This commit is contained in:
bordun 2020-03-09 19:12:43 +01:00
parent cee4cb81b7
commit 4f31985930
59 changed files with 1299 additions and 781 deletions

View file

@ -25,7 +25,7 @@ class Menu extends Widget {
layout: {type: 'string', value: 'circular', choices: ['circular', 'horizontal', 'vertical', 'grid'], help: [
'Defines whether the menu\'s layout should be rendered in a circle or in a box'
]},
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
toggle: {type: 'boolean', value: false, help: 'Set to `true` to make the menu stay opened after mouse/touch release'},
doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the menu require a double tap to be opened instead of a single tap'},
values: {type: 'array|object', value: [1, 2, 3], help: [

View file

@ -18,7 +18,7 @@ class Switch extends Widget {
_switch:'switch',
layout: {type: 'string', value: 'vertical', choices: ['vertical', 'horizontal', 'grid'], help:''},
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
showValues: {type: 'boolean', value: false, help: 'If values is an object, set to `true` to display both values and labels instead of labels only'},
values: {type: 'array|object', value: {'Value 1':1,'Value 2':2}, help: [
'`Array` of possible values to switch between : `[1,2,3]`',

View file

@ -47,7 +47,7 @@ class Toggle extends Widget {
if (this.getProp('led')) this.container.classList.add('led')
var tap = this.getProp('mode') === 'tap',
push = this.getProp('mode') === 'push' || tap
push = this.getProp('mode') === 'push' || tap
if (push) {
@ -58,6 +58,8 @@ class Toggle extends Widget {
this.active = true
this.setValue(this.getProp('on'), {sync: true, send: true})
if (tap) this.container.classList.add('active')
})
} else {

View file

@ -22,7 +22,7 @@ class Matrix extends StaticProperties(Panel, {scroll: false}) {
widgetType: {type: 'string', value: 'toggle', help: 'Defines the type of the widgets in the matrix'},
layout: {type: 'string', value: 'horizontal', choices: ['horizontal', 'vertical', 'grid'], help:''},
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
quantity: {type: 'number', value: 4, help: 'Defines the number of widgets in the matrix'},
start: {type: 'integer', value: 0, help: 'First widget\'s index'},
traversing: {type: 'boolean', value: true, help: 'Set to `false` to disable traversing gestures'},

View file

@ -28,7 +28,7 @@ class Modal extends Panel {
popupTop: {type: 'number|percentage', value: 'auto', help: 'Modal popup\'s position'},
colorPanel: {type: 'string', value: 'auto', help:''},
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:''},
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
traversing: {type: 'boolean', value: false, help: 'Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget'},
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},

View file

@ -22,8 +22,8 @@ class Panel extends Container() {
colorPanel: {type: 'string', value: 'auto', help:''},
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:''},
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
verticalTabs: {type: 'boolean', value: false, help: 'Set to `true` to display for vertical tab layout'},
traversing: {type: 'boolean', value: false, help: 'Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget'},
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
@ -63,7 +63,7 @@ class Panel extends Container() {
} else if (layout === 'vertical' || layout === 'horizontal'){
var justify = this.getProp('justify')
if (justify === 'start' || justify === 'end') justify = 'flex-' + justify
if (justify === 'start' || justify === 'end') justify = 'flex-' + justify
this.widget.style.justifyContent = justify
}

View file

@ -22,8 +22,8 @@ class Root extends StaticProperties(Panel, {scroll: false, label: false, id: 'ro
colorPanel: {type: 'string', value: 'auto', help:''},
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:''},
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
verticalTabs: {type: 'boolean', value: false, help: 'Set to `true` to display for vertical tab layout'},
traversing: {type: 'boolean', value: false, help: 'Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget'},
variables: {type: '*', value: '', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
@ -58,13 +58,6 @@ class Root extends StaticProperties(Panel, {scroll: false, label: false, id: 'ro
DOM.each(this.widget, '> .navigation', (el)=>{
el.classList.add('main')
})
this.trigger('root-nav-changed')
}
createNavigation() {
super.createNavigation()
}

View file

@ -18,15 +18,15 @@ module.exports = class Tab extends Panel {
// detached: {type: 'boolean', value: true, help: 'Set to `false` if the tab contains `frame` widgets that should not be reloaded when the tab opens'},
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:''},
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
verticalTabs: {type: 'boolean', value: false, help: 'Set to `true` to display for vertical tab layout'},
traversing: {type: 'boolean', value: false, help: 'Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget'},
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
}, [
'_geometry', 'left', 'top', 'width', 'height',
'_geometry', 'left', 'top', 'width', 'height', 'expand',
'colorStroke', 'alphaStroke', 'alphaFillOff', 'alphaFillOn'
], {

View file

@ -23,7 +23,6 @@ module.exports = class Eq extends StaticProperties(Plot, {rangeX: {min: 20, max:
rangeY: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the y axis'},
origin: {type: 'number|boolean', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it'},
logScaleX: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the x axis (base 10). Set to a `number` to define the logarithm\'s base.'},
smooth: {type: 'boolean|number', value: false, help: 'Set to `true` to make the line smooth. Float values are also acceptable (works fine between `0` and `0.5`)'},
}, ['interaction', 'decimals', 'typeTags', 'bypass'], {

View file

@ -25,7 +25,6 @@ module.exports = class Plot extends StaticProperties(Canvas, {bypass: true, inte
origin: {type: 'number', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it.'},
dots: {type: 'boolean', value: true, help: ''},
bars: {type: 'boolean', value: false, help: 'Set to `true` to use draw bars instead (disables `logScaleX` and forces `x axis` even spacing)'},
smooth: {type: 'boolean|number', value: false, help: 'Set to `true` to make the line smooth. Float values are also acceptable (works fine between `0` and `0.5`)'},
pips:{type: 'boolean', value: true, help: 'Set to `false` to hide the scale'},
}, ['interaction', 'decimals', 'typeTags', 'bypass'], {
@ -141,18 +140,11 @@ module.exports = class Plot extends StaticProperties(Canvas, {bypass: true, inte
this.ctx.beginPath()
if (this.getProp('smooth')) {
this.ctx.curve(points, this.smooth, Math.round(this.width/(points.length/2 - 1)))
} else {
this.ctx.moveTo(points[0], points[1])
let i
for (i = 2; i < points.length - 2; i += 2) {
this.ctx.lineTo(points[i], points[i + 1])
}
this.ctx.moveTo(points[0], points[1])
for (let i = 2; i < points.length - 2; i += 2) {
this.ctx.lineTo(points[i], points[i + 1])
}
this.ctx.lineTo(points[i], points[i + 1])
this.ctx.globalAlpha = 1
this.ctx.lineWidth = 2 * PXSCALE

View file

@ -50,6 +50,7 @@ module.exports = class Keyboard extends Panel {
super(options)
this.childrenType = undefined
this.value = []
this.on('change',(e)=>{

View file

@ -100,7 +100,7 @@ class CanvasWidget extends Canvas {
setValue(v, options={}) {
if (v === null || v === undefined || ((v.length || 1) !== this.getProp('valueLength'))) return
if (v === null || v === undefined || ((v.length || 1) !== this.getProp('valueLength'))) return
this.value = v

View file

@ -283,7 +283,7 @@ class HueFader extends Fader {
this.clear()
this.ctx.strokeStyle = this.gaugeGradient || this.cssVars.colorFill
this.ctx.strokeStyle = this.gaugeGradient || this.cssVars.colorFill
if (flat) {
this.ctx.lineWidth = Math.round(width - this.gaugePadding * 2)

View file

@ -191,7 +191,7 @@ module.exports = class Fader extends Slider {
}
this.ctx.strokeStyle = this.gaugeGradient || this.cssVars.colorFill
this.ctx.strokeStyle = this.gaugeGradient || this.cssVars.colorFill
if (compact) {
this.ctx.lineWidth = Math.round(width - this.gaugePadding * 2)

View file

@ -215,7 +215,7 @@ class Range extends Fader {
}
this.ctx.strokeStyle = this.gaugeGradient || this.cssVars.colorFill
this.ctx.strokeStyle = this.gaugeGradient || this.cssVars.colorFill
if (compact) {
this.ctx.lineWidth = Math.round(width - this.gaugePadding * 2)