rename precision to decimals, add typeTags, continue refactoring

This commit is contained in:
bordun 2020-02-29 17:01:29 +01:00
parent f41ac14698
commit a58075c602
54 changed files with 426 additions and 256 deletions

View file

@ -94,11 +94,11 @@ class UiInspectorField extends UiWidget {
} else if (this.name.includes('color')) {
let style = window.getComputedStyle(this.widget.container),
cssName = this.widget.constructor.cssVariables.find(x=>x.js === this.name).css,
colorData = this.widget.constructor.cssVariables.find(x=>x.js === this.name),
val = '#000'
try {
val = chroma(style.getPropertyValue('--' + this.name.replace(/([A-Z])/g, (a,s)=>'-' + s.toLowerCase())).trim()).hex('rgb')
val = chroma(style.getPropertyValue(colorData.css).trim()).hex('rgb')
} catch(e) {console.log(e)}
let picker = html`<osc-inspector-color type="text" name="${this.name}" value="${val}" style="--color-picker-value: ${val}"></osc-inspector-color>`

View file

@ -179,7 +179,7 @@ class UiInspector extends UiWidget {
if (this.colorPicker.opened) {
var picker = DOM.get(this.container, `osc-inspector-color[name="${this.colorPicker.name}"]`)
if (picker) {
if (picker && picker[0]) {
this.colorPicker.setValue(picker[0].getAttribute('value'))
} else {
this.colorPicker.close()

View file

@ -3,7 +3,7 @@ var UiWidget = require('./ui-widget'),
doubleClick = require('../events/double-click'),
Sortable = require('sortablejs'),
morph = require('nanomorph'),
Panel, Matrix, widgetManager
Panel, Matrix, Keyboard, widgetManager
class UiTree extends UiWidget {
@ -11,6 +11,7 @@ class UiTree extends UiWidget {
Panel = require('../widgets/containers/panel')
Matrix = require('../widgets/containers/matrix')
Keyboard = require('../widgets/matrices/keyboard')
widgetManager = require('../managers/widgets')
super(options)
@ -144,7 +145,7 @@ class UiTree extends UiWidget {
data-id="${id}"">
${id}</li>`
if (widget instanceof Panel && !(widget instanceof Matrix)) {
if (widget instanceof Panel && !(widget instanceof Matrix || widget instanceof Keyboard)) {
node.insertBefore(html`<span class="toggle no-widget-select"></span>`, node.childNodes[0])
node.classList.add('container')
if (this.expanded[id]) node.classList.add('expanded')