fastdom: clean

This commit is contained in:
jean-emmanuel 2022-01-26 16:40:39 +01:00
parent df74279db2
commit 2f38353483
3 changed files with 21 additions and 35 deletions

View file

@ -2,7 +2,6 @@ var widgetManager = require('../managers/widgets'),
resize = require('../events/resize'),
stateManager = require('../managers/state'),
parser = require('../parser'),
fastdom = require('fastdom'),
Panel, Matrix,
editor,
scrollState = {}
@ -114,9 +113,7 @@ function updateWidget(widget, options={}) {
index: index
})
// fastdom.mutate(()=>{
newWidget.container.parentNode.replaceChild(newWidget.container, widget.container)
// })
newWidget.container.parentNode.replaceChild(newWidget.container, widget.container)
if (newWidget.getProp('type') === 'tab') newWidget.parent.trigger('tab-created', {widget: widget})

View file

@ -11,8 +11,7 @@ var UiWidget = require('./ui-widget'),
scriptGlobals = ScriptVm.globals,
editors = {}, editorModes = {
javascript: require('brace/mode/javascript')
},
fastdom = require('fastdom')
}
function createEditor(name, language, syntaxChecker) {
var el = html`<div id="#editor${name}"></div>`
@ -157,33 +156,25 @@ class UiInspectorField extends UiWidget {
colorData = this.widget.constructor.cssVariables.find(x=>x.js === this.name),
val = 'transparent'
// fastdom.measure(()=>{
try {
val = chroma(style.getPropertyValue(colorData.css).trim()).hex('rgba')
} catch(e) {}
// fastdom.mutate(()=>{
this.container.appendChild(html`
<osc-inspector-color type="text" name="${this.name}" value="${val}" style="--color-picker-value: ${val}"></osc-inspector-color>
`)
// })
try {
val = chroma(style.getPropertyValue(colorData.css).trim()).hex('rgba')
} catch(e) {}
this.container.appendChild(html`
<osc-inspector-color type="text" name="${this.name}" value="${val}" style="--color-picker-value: ${val}"></osc-inspector-color>
`)
// })
} else if (stringValue === 'auto' && this.widget.constructor.cssVariables.some(x=>x.js === this.name)) {
// fastdom.measure(()=>{
let style = window.getComputedStyle(this.widget.container),
data = this.widget.constructor.cssVariables.find(x=>x.js === this.name),
val = style.getPropertyValue(data.css).trim()
let style = window.getComputedStyle(this.widget.container),
data = this.widget.constructor.cssVariables.find(x=>x.js === this.name),
val = style.getPropertyValue(data.css).trim()
if (data.toJs) val = data.toJs(val)
// fastdom.mutate(()=>{
this.container.appendChild(html`
<div class="computed-value">${val}</div>
`)
// })
if (data.toJs) val = data.toJs(val)
this.container.appendChild(html`
<div class="computed-value">${val}</div>
`)
// })
}

View file

@ -177,14 +177,12 @@ module.exports = class MultiXy extends Pad {
super.resizeHandle(event)
fastdom.measure(()=>{
for (var k in this.pads) {
this.pads[k].width = this.width
this.pads[k].height = this.height
this.pads[k].padPadding = this.padPadding
}
this.updateHandlesPosition()
})
for (var k in this.pads) {
this.pads[k].width = this.width
this.pads[k].height = this.height
this.pads[k].padPadding = this.padPadding
}
this.updateHandlesPosition()
}