minor fixes & stacktrace folding in terminal

This commit is contained in:
bordun 2020-03-13 16:28:43 +01:00
parent f58db44858
commit c4559315f7
11 changed files with 56 additions and 17 deletions

View file

@ -17,11 +17,11 @@ window.onerror = function(msg,url,row,col, error) {
}).join('\n')
ipc.send('errorLog', `[Renderer process error]\n${msg}\n${stringifiedStack}`)
ipc.send('errorLog', `(ERROR, CLIENT) ${msg}\n${stringifiedStack}`)
}).catch(()=>{
ipc.send('errorLog', `[Renderer process error]\n${msg}\n at ${url}:${row}:${col}\n (no stacktrace available)`)
ipc.send('errorLog', `(ERROR, CLIENT) ${msg}\n at ${url}:${row}:${col}\n (no stacktrace available)`)
})

View file

@ -89,6 +89,8 @@ class UiTree extends UiWidget {
var content = this.parseWidgets(widgetManager.getWidgetById('root')[0], selectedWidgets)
if (!content) return
// morph DOM
if (this.mounted) {
morph(this.list.firstChild, content)
@ -155,6 +157,8 @@ class UiTree extends UiWidget {
parseWidgets(widget, selectedWidgets, depth = 1) {
if (!widget) return
var selected = selectedWidgets.includes(widget),
id = widget.getProp('id'),
node = html`<li class="${selected ? 'editing' : ''} ${!widget.getProp('visible') ? 'invisible' : ''}"
@ -168,7 +172,7 @@ class UiTree extends UiWidget {
if (this.expanded[id]) node.classList.add('expanded')
var sublist = node.appendChild(html`<ol style="--depth:${++depth};"></ol>`)
for (let child of widget.children) {
sublist.appendChild(this.parseWidgets(child, selectedWidgets, depth))
if (child) sublist.appendChild(this.parseWidgets(child, selectedWidgets, depth))
}
}

View file

@ -498,9 +498,6 @@ class Widget extends EventEmitter {
}
// backward compat
if (k === '_value') k = 'value'
var widgets = id == 'parent' && this.parent ?
[this.parent] : id == 'this' ? [this] :
widgetManager.getWidgetById(id)
@ -869,7 +866,7 @@ class Widget extends EventEmitter {
this.container.classList.remove('no-label')
var label = this.getProp('label') == 'auto'?
this.getProp('id'):
iconify(this.getProp('label').replace(/</g, '&lt;'))
iconify(String(this.getProp('label')).replace(/</g, '&lt;'))
this.label.innerHTML = label
this.container.appendChild(this.label)

View file

@ -65,7 +65,7 @@ module.exports = class Rgb extends Widget {
this.hue = new HueFader({props:{
...faderDefaults,
type: 'fader',
mode: 'line',
design: 'default',
label: false,
pips:false,
horizontal:false,
@ -84,6 +84,7 @@ module.exports = class Rgb extends Widget {
this.alpha = new Fader({props:{
...faderDefaults,
type: 'fader',
design: 'compact',
label:false,
pips:false,
horizontal:true,

View file

@ -17,9 +17,9 @@ module.exports = class Fader extends Slider {
_fader:'fader',
design: {type: 'string', value: 'compact', choices: ['compact', 'classic', 'round'], help: 'Design style'},
design: {type: 'string', value: 'default', choices: ['default', 'round', 'compact'], help: 'Design style'},
horizontal: {type: 'boolean', value: false, help: 'Set to `true` to display the fader horizontally'},
pips: {type: 'boolean', value: false, help: 'Set to `true` to show range breakpoints'},
pips: {type: 'boolean', value: false, help: 'Set to `true` to show range breakpoints (ignored if `design` is `compact`)'},
dashed: {type: 'boolean', value: false, help: 'Set to `true` to display a dashed gauge'},
gradient: {type: 'array|object', value: [], help: [
'When set, the meter\'s gauge will be filled with a linear color gradient',
@ -162,7 +162,7 @@ module.exports = class Fader extends Slider {
super.cacheCanvasStyle(style)
if (this.getProp('pips')) this.drawPips()
if (this.getProp('pips') && this.getProp('design') !== 'compact') this.drawPips()
}
@ -253,7 +253,7 @@ module.exports = class Fader extends Slider {
this.clearRect = [0, 0, width, height]
} else if (this.getProp('design') === 'classic') {
} else if (this.getProp('design') === 'default') {
if (this.cssVars.alphaStroke) {
@ -300,7 +300,7 @@ module.exports = class Fader extends Slider {
this.ctx.fillStyle = this.cssVars.colorFill
this.ctx.beginPath()
this.ctx.arc(m, d, 10 * PXSCALE, 0, 2 * Math.PI)
this.ctx.arc(m, d, 9 * PXSCALE, 0, 2 * Math.PI)
this.ctx.fill()
}
@ -308,7 +308,7 @@ module.exports = class Fader extends Slider {
}
if (this.getProp('pips')) {
if (this.getProp('pips') && !compact) {
this.ctx.globalAlpha = 1
this.ctx.drawImage(this.pips, 0, 0);
if (!compact) this.clearRect = [this.clearRect, [m + 10 * PXSCALE, 0, 10 * PXSCALE + this.pipsTextSize, height]]