Merge branch 'master' of github.com:jean-emmanuel/open-stage-control

This commit is contained in:
bordun 2020-05-17 23:07:56 +02:00
commit 50cb3c429f
14 changed files with 114 additions and 62 deletions

View file

@ -52,7 +52,7 @@ class Editor {
this.widgetTree.on('sorted', (event)=>{
var {widget, oldIndex, newIndex} = event,
propName = widget.props.tabs.length ? 'tabs' : 'widgets'
propName = widget.props.tabs && widget.props.tabs.length ? 'tabs' : 'widgets'
if (widget.props[propName].length < 2) return
@ -169,7 +169,7 @@ class Editor {
handleKeyboard(combo, e){
if (e.target && (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.tagName === 'SELECT')) return
if (this.inspector.helpModalOpened || e.target && (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.tagName === 'SELECT')) return
e.preventDefault()

View file

@ -32,6 +32,7 @@ class UiDragResize extends UiWidget {
this.width = 0
this.height = 0
this.widgets = []
this.mounted = false
this.handles = DOM.get(this.container, '.handle')
@ -94,6 +95,10 @@ class UiDragResize extends UiWidget {
}, {element: this.container})
window.addEventListener('resize', ()=>{
if (this.mounted) this.updateRectangle()
})
// this.handles[0]._ignore_css_transforms = true
}
@ -104,6 +109,7 @@ class UiDragResize extends UiWidget {
this.container.parentNode.removeChild(this.container)
this.mounted = false
this.widgets = []
}
@ -112,11 +118,22 @@ class UiDragResize extends UiWidget {
this.clear()
widgets = widgets.slice().filter(w=>w.getProp('visible') && !(w instanceof Tab) && !(w instanceof Root))
this.widgets = widgets.slice().filter(w=>w.getProp('visible') && !(w instanceof Tab) && !(w instanceof Root))
if (!widgets.length) return
if (!this.widgets.length) return
var widget = widgets[0]
this.updateRectangle()
this.widgets[0].parentNode.appendChild(this.container)
this.mounted = true
}
updateRectangle() {
var widgets = this.widgets,
widget = widgets[0]
var handlesVisibility = [
widget.parent.getProp('layout') === 'default', // nw
@ -129,8 +146,7 @@ class UiDragResize extends UiWidget {
this.handles[i].style.display = handlesVisibility[i] ? '' : 'none'
}
var parent = widget.parentNode,
lefts = widgets.map(w => w.container.offsetLeft),
var lefts = widgets.map(w => w.container.offsetLeft),
tops = widgets.map(w => w.container.offsetTop),
rights = widgets.map(w => w.container.offsetLeft + w.container.offsetWidth),
bottoms = widgets.map(w => w.container.offsetTop + w.container.offsetHeight)
@ -145,9 +161,6 @@ class UiDragResize extends UiWidget {
this.updateCss()
parent.appendChild(this.container)
this.mounted = true
}
updateCss(grid) {

View file

@ -85,6 +85,8 @@ class UiInspector extends UiWidget {
this.lock = false
this.clearTimeout = null
this.helpModalOpened = false
}
clear() {
@ -269,7 +271,7 @@ class UiInspector extends UiWidget {
computedValue = JSON.stringify(computedValue, null, ' ')
}
new UiModal({closable: true, title: html`<span class="editor-help-title">${name}</span>`, html: true, content: html`
var modal = new UiModal({closable: true, title: html`<span class="editor-help-title">${name}</span>`, html: true, content: html`
<div class="inspector-help">
<div class="header">
@ -291,6 +293,12 @@ class UiInspector extends UiWidget {
</div>
`})
this.helpModalOpened = true
modal.on('close', ()=>{
this.helpModalOpened = false
})
}
}

View file

@ -142,14 +142,14 @@ var menuEntries = [
label: locales('editor_grid'),
class: ()=>{return 'toggle ' + (editor.grid ? 'on' : 'off')},
action: editor.toggleGrid.bind(editor),
// shortcut: 'mod + g'
shortcut: 'mod + g'
},
{
label: locales('editor_tree'),
class: ()=>{return 'toggle ' + (leftUiSidePanel.minimized ? 'off' : 'on')},
action: ()=>{return leftUiSidePanel.minimized ? leftUiSidePanel.restore() : leftUiSidePanel.minimize()},
// shortcut: 'mod + t'
shortcut: 'mod + t'
},
@ -157,7 +157,7 @@ var menuEntries = [
label: locales('editor_inspector'),
class: ()=>{return 'toggle ' + (rightUiSidePanel.minimized ? 'off' : 'on')},
action: ()=>{return rightUiSidePanel.minimized ? rightUiSidePanel.restore() : rightUiSidePanel.minimize()},
// shortcut: 'mod + i'
shortcut: 'mod + i'
}
]
},

View file

@ -116,6 +116,14 @@ class Switch extends MenuBase {
}
}
setCssVariables() {
super.setCssVariables()
this.container.classList.toggle('padding-0', this.getProp('padding') === -1)
}
}
Switch.cssVariables = Switch.prototype.constructor.cssVariables.concat(

View file

@ -157,7 +157,7 @@ class ScriptVm extends Vm {
filter = Array.isArray(filter) ? filter : [filter]
var containers = this.filter.map(x=>this.resolveId(id)).reduce((a,b)=>a.concat(b), [])
var containers = filter.map(x=>this.resolveId(x)).reduce((a,b)=>a.concat(b), [])
if (!containers.length) return
filter = (widget)=>{

View file

@ -2,7 +2,6 @@
background: var(--color-background);
display: block;
padding: 0 15rem;
border-radius: 2rem;
position: relative;
white-space: nowrap;
text-overflow: ellipsis;

View file

@ -10,7 +10,7 @@ $padding: 8rem;
height: 40rem;
flex-shrink: 0;
line-height: 40rem;
padding-left: $padding;
padding-left: $padding + 2rem;
background: var(--color-ui-button);
}
@ -66,10 +66,12 @@ $padding: 8rem;
height: 42rem + $padding * 2;
line-height: 38rem;
flex-shrink: 0;
border: $padding solid var(--color-ui-background);
padding: 1rem;
// border: $padding solid var(--color-ui-background);
padding: $padding;
background: var(--color-ui-background);
.btn, input {
margin: 1rem;;
margin: 1rem;
margin-left: $padding;
text-overflow: clip;
min-width: 0;
background: var(--color-ui-button);

View file

@ -189,10 +189,6 @@ osc-inspector-checkbox {
@include pseudo-fill($z: -1);
z-index: 1;
&:after {
border-radius: 2rem;
}
&.on {
--color-fill: var(--color-widget);
--alpha-fill: 0.5;
@ -277,7 +273,6 @@ osc-inspector-color {
--widget-padding: 1rem;
@include pseudo-fill();
&:after {
border-radius: 2rem;
border: 1rem solid var(--color-ui-button)
}
}

View file

@ -12,7 +12,7 @@
.button-container {
--alpha-fill-off: 0;
--alpha-fill-off: .15;
--alpha-fill-on: .75;
--widget-padding: -1rem;
--color-text-on: var(--color-background);
@ -57,17 +57,29 @@
.switch-container {
--alpha-fill-off: .15;
--alpha-fill-on: 0.75;
--alpha-fill: var(--alpha-fill-off);
--color-text-on: var(--color-background);
inner {
@include pseudo-stroke();
&:before {
margin: var(--widget-spacing);
}
inner {
position: relative;
display: flex;
flex-direction: column;
--widget-spacing: calc(var(--widget-padding) / 2);
margin: calc(var(--widget-spacing) + 1rem);
@include pseudo-stroke();
}
&.padding-0 inner {
// style fix for padding == -1
margin: 0;
}
@ -96,6 +108,9 @@
text-overflow: clip;
overflow: hidden;
@include pseudo-fill($z: -1);
&:after {
margin: calc(var(--widget-spacing) - 1rem);
}
&.on {
--alpha-fill: var(--alpha-fill-on);
@ -118,10 +133,12 @@
.menu-container {
--alpha-fill: 0.75;
--alpha-fill-off: .15;
--alpha-fill-on: .75;
--alpha-fill-hover: calc(var(--alpha-fill-on) / 2);
--widget-padding: 1rem;
--text-padding: calc(var(--widget-padding) + 8rem);
border-radius: 0!important; // border radius breaks it somehow
z-index: initial!important;
// contain: style size;
@ -148,6 +165,7 @@
align-items: center;
position: relative;
@include pseudo-stroke();
@include pseudo-fill($z: -1);
&.text-align-right .text {
justify-content: flex-end;
@ -179,8 +197,7 @@
display: flex;
justify-content: center;
align-items: center;
padding-left: var(--widget-padding);
padding-right: var(--widget-padding);
padding-left: var(--text-padding);
}
.icon {
order: 1;
@ -191,11 +208,10 @@
width: 30rem;
height: calc(100% - 2rem);
font-family: FontAwesome;
color: var(--color-stroke);
font-size: 120%;
border-left: 1rem solid var(--color-stroke);
opacity: var(--alpha-stroke);
margin: 1rem 0;
margin-right: var(--widget-padding);
z-index: 1;
&:after {
content:"\f107";
}
@ -290,10 +306,10 @@
}
&.on div:before {
opacity: var(--alpha-fill)!important;
opacity: var(--alpha-fill-on)!important;
}
&.active div:before, &:hover div:before {
opacity: calc(var(--alpha-fill) / 2);
opacity: var(--alpha-fill-hover);
}
@ -341,13 +357,13 @@
&.on {
color: var(--color-background);
div:after {
opacity: var(--alpha-fill)!important;
opacity: var(--alpha-fill-on)!important;
}
}
&.active, &:hover {
div:after, div:after {
opacity: calc(var(--alpha-fill) / 2);
opacity: var(--alpha-fill-hover);
}
}
@ -374,10 +390,11 @@
.dropdown-container {
--alpha-fill: 0.75;
--alpha-fill-off: .15;
--alpha-fill-on: .75;
--widget-padding: 1rem;
--text-padding: calc(var(--widget-padding) + 8rem);
border-radius: 0!important; // border radius breaks it somehow
z-index: initial!important;
// contain: style size;
@ -400,6 +417,7 @@
align-items: stretch;
position: relative;
@include pseudo-stroke();
@include pseudo-fill($z: -1);
&.right .text {
justify-content: flex-end;
@ -415,8 +433,7 @@
display: flex;
justify-content: center;
align-items: center;
padding-left: var(--widget-padding);
padding-right: var(--widget-padding);
padding-left: var(--text-padding);
}
.icon {
order: 1;
@ -426,10 +443,8 @@
align-items: center;
width: 30rem;
font-family: FontAwesome;
color: var(--color-stroke);
font-size: 120%;
border-left: 1rem solid var(--color-stroke);
opacity: var(--alpha-stroke);
margin-right: var(--widget-padding);
&:after {
content:"\f107";
}
@ -456,6 +471,7 @@
.input-container {
--alpha-fill-off: 0.05;
--text-padding: calc(var(--widget-padding) + 8rem);
inner {
position: relative;
@ -472,8 +488,7 @@
text-align: left;
}
padding-left: calc(var(--widget-padding) * 2);
padding-right: calc(var(--widget-padding) * 2);
padding: 0 var(--text-padding);
}
@ -527,8 +542,10 @@
.file-container {
--alpha-fill: 0.75;
--alpha-fill-off: .15;
--alpha-fill-on: .75;
--widget-padding: 1rem;
--text-padding: calc(var(--widget-padding) + 8rem);
inner {
flex:1;
@ -538,6 +555,7 @@
align-items: stretch;
position: relative;
@include pseudo-stroke();
@include pseudo-fill($z: -1);
&.right .text {
justify-content: flex-end;
@ -553,8 +571,7 @@
display: flex;
justify-content: center;
align-items: center;
padding-left: var(--widget-padding);
padding-right: var(--widget-padding);
padding-left: var(--text-padding);
min-width: 0;
overflow: hidden;
}
@ -566,10 +583,8 @@
align-items: center;
width: 30rem;
font-family: FontAwesome;
color: var(--color-stroke);
font-size: 120%;
border-left: 1rem solid var(--color-stroke);
opacity: var(--alpha-stroke);
margin-right: var(--widget-padding);
&:after {
content:"\f07c";
}

View file

@ -346,7 +346,7 @@
&.empty {
@include pseudo-stroke();
&:before {
content:"clone"
margin: var(--widget-spacing);
}
}
@ -384,11 +384,11 @@
--widget-padding: 4rem;
--color-text-on: var(--color-background);
--alpha-fill-off: 0.15;
--alpha-fill-on: .75;
> .toggle {
--alpha-fill-off: 0;
--alpha-fill-on: .75;
--widget-padding: -1rem;
position: absolute;

View file

@ -38,7 +38,8 @@
--alpha-stroke: 0;
--alpha-fill-off: 0.1;
--alpha-fill-on: 1;
--widget-padding: -1;
--widget-padding: -1rem;
--text-padding: calc(var(--widget-padding) + 8rem);
inner {
@include pseudo-stroke();
@ -64,7 +65,7 @@
overflow: hidden;
text-align: center;
word-wrap: break-word;
border: 2rem solid transparent;
padding: 0 var(--text-padding);
&.right {
text-align: right;
@ -83,6 +84,13 @@
text-overflow: ellipsis;
-webkit-writing-mode:vertical-rl;
writing-mode:vertical-rl;
i {
transform: rotate(180deg);
writing-mode: initial;
}
}
i {
margin-top: -1rem;
}
}
}