Merge branch 'master' of github.com:jean-emmanuel/open-stage-control
This commit is contained in:
commit
7ffa07282a
15 changed files with 109 additions and 47 deletions
|
|
@ -85,13 +85,7 @@ var handleClick = function(event) {
|
|||
label: icon('project-diagram') + ' ' + locales('editor_show_in_tree'),
|
||||
action: ()=>{
|
||||
editor.widgetTree.showWidget(editor.selectedWidgets[0])
|
||||
DOM.each(editor.widgetTree.list, '.editing', (el)=>{
|
||||
el.classList.add('editor-blink')
|
||||
el.scrollIntoView({block: 'center'})
|
||||
setTimeout(()=>{
|
||||
el.classList.remove('editor-blink')
|
||||
}, 800)
|
||||
})
|
||||
editor.widgetTree.blinkSelected()
|
||||
},
|
||||
shortcut: 't'
|
||||
})
|
||||
|
|
|
|||
|
|
@ -438,6 +438,8 @@ class Editor {
|
|||
case 't':
|
||||
if (!this.selectedWidgets.length) return
|
||||
this.widgetTree.showWidget(editor.selectedWidgets[0])
|
||||
this.widgetTree.blinkSelected()
|
||||
|
||||
break
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -223,6 +223,18 @@ class UiTree extends UiWidget {
|
|||
|
||||
}
|
||||
|
||||
blinkSelected() {
|
||||
|
||||
DOM.each(this.list, '.editing', (el)=>{
|
||||
el.classList.add('editor-blink')
|
||||
el.scrollIntoView({block: 'center'})
|
||||
setTimeout(()=>{
|
||||
el.classList.remove('editor-blink')
|
||||
}, 800)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
select() {
|
||||
|
||||
// hint selection in folded containers
|
||||
|
|
|
|||
|
|
@ -235,6 +235,7 @@ class Widget extends EventEmitter {
|
|||
}
|
||||
}
|
||||
|
||||
this.style = null
|
||||
this.container = html`
|
||||
<div class="widget ${options.props.type}-container" id="${this.hash}" data-widget="${this.hash}"></div>
|
||||
`
|
||||
|
|
@ -516,7 +517,7 @@ class Widget extends EventEmitter {
|
|||
if (content.indexOf('@{') >= 0) {
|
||||
|
||||
content = balancedReplace('@', '{', '}', content, (subcontent)=>{
|
||||
return this.resolveProp(propName, '@{' + subcontent + '}', storeLinks ? 'nested' : false, this)
|
||||
return this.resolveProp(content, '@{' + subcontent + '}', storeLinks ? 'nested' : false, this)
|
||||
})
|
||||
|
||||
}
|
||||
|
|
@ -1028,51 +1029,61 @@ class Widget extends EventEmitter {
|
|||
|
||||
|
||||
var prefix = '#' + this.hash,
|
||||
scopedCss = scopeCss(css, prefix),
|
||||
scopedCss = '',
|
||||
unScopedCss = ''
|
||||
|
||||
if (css.includes('{')) {
|
||||
|
||||
try {
|
||||
scopedCss = scopeCss(css, prefix)
|
||||
try {
|
||||
|
||||
dummyDOM.style = css
|
||||
unScopedCss = dummyDOM.getAttribute('style') || ''
|
||||
dummyDOM.style = css
|
||||
unScopedCss = dummyDOM.getAttribute('style') || ''
|
||||
|
||||
} catch(err) {
|
||||
} catch(err) {
|
||||
|
||||
// fallback for browser that don't allow assigning "style" property
|
||||
css
|
||||
// fallback for browser that don't allow assigning "style" property
|
||||
css
|
||||
.replace(/\{[^}]*\}/g, '')
|
||||
.replace(/^[^@#.]*:.*/gm, (m)=>{
|
||||
unScopedCss += m[m.length - 1] === ';' ? m : m + ';'
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
if (scopedCss.indexOf('@keyframes') > -1) scopedCss = scopedCss.replace(new RegExp(prefix + '\\s+([0-9]+%|to|from)', 'g'), ' $1')
|
||||
if (scopedCss.indexOf('&') > -1) scopedCss = scopedCss.replace(new RegExp(prefix + '\\s&', 'g'), prefix)
|
||||
|
||||
} else {
|
||||
|
||||
unScopedCss = css
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (scopedCss.indexOf('@keyframes') > -1) scopedCss = scopedCss.replace(new RegExp(prefix + '\\s+([0-9]+%|to|from)', 'g'), ' $1')
|
||||
if (scopedCss.indexOf('&') > -1) scopedCss = scopedCss.replace(new RegExp(prefix + '\\s&', 'g'), prefix)
|
||||
|
||||
var style = html`<style>${unScopedCss ? prefix + '{' + unScopedCss + '}\n' : ''}${scopedCss}</style>`,
|
||||
oldStyle = DOM.get(this.container, '> style')[0]
|
||||
var style = (unScopedCss ? prefix + '{' + unScopedCss + '}\n' : '') + scopedCss
|
||||
|
||||
if (oldStyle) {
|
||||
this.container.replaceChild(style, oldStyle)
|
||||
if (this.style) {
|
||||
this.style.innerText = style
|
||||
} else if (scopedCss.length || unScopedCss.length){
|
||||
this.container.insertBefore(style, this.container.childNodes[0] || null)
|
||||
this.style = html`<style>${style}</style>`
|
||||
this.container.insertBefore(this.style, this.container.childNodes[0] || null)
|
||||
}
|
||||
|
||||
|
||||
// apply extra css classes
|
||||
if (!deepEqual(extraCssClasses, this.extraCssClasses)) {
|
||||
if (this.extraCssClasses && this.extraCssClasses.length) {
|
||||
this.container.classList.remove(...this.extraCssClasses)
|
||||
this.extraCssClasses = []
|
||||
}
|
||||
|
||||
if (this.extraCssClasses && this.extraCssClasses.length) {
|
||||
this.container.classList.remove(...this.extraCssClasses)
|
||||
this.extraCssClasses = []
|
||||
}
|
||||
|
||||
if (extraCssClasses.length) {
|
||||
this.container.classList.add(...extraCssClasses)
|
||||
this.extraCssClasses = extraCssClasses
|
||||
if (extraCssClasses.length) {
|
||||
this.container.classList.add(...extraCssClasses)
|
||||
this.extraCssClasses = extraCssClasses
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1090,9 +1101,6 @@ class Widget extends EventEmitter {
|
|||
|
||||
}
|
||||
|
||||
return style
|
||||
|
||||
|
||||
}
|
||||
|
||||
setCssVariables() {
|
||||
|
|
|
|||
|
|
@ -176,9 +176,10 @@ class Matrix extends Panel {
|
|||
propValue = JSON.stringify(propValue)
|
||||
}
|
||||
|
||||
var data = []
|
||||
for (var i = 0; i < this.getProp('quantity'); i++) {
|
||||
data[i] = super.resolveProp(propName, propValue, storeLinks, originalWidget, originalPropName, {$: i})
|
||||
var data = [],
|
||||
quantity = this.resolveProp('quantity', undefined, false, false, false)
|
||||
for (var i = 0; i < quantity; i++) {
|
||||
data[i] = super.resolveProp(propName, propValue, i === 0 ? storeLinks : false, originalWidget, originalPropName, {$: i})
|
||||
}
|
||||
|
||||
return data
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class Modal extends Panel {
|
|||
this.popupContent = DOM.get(this.popup, '.popup-content')[0]
|
||||
|
||||
|
||||
if (iOS13) {
|
||||
if (iOS13 && this.getProp('scroll')) {
|
||||
for (let dir in this.iosScrollbars) {
|
||||
this.container.removeChild(this.iosScrollbars[dir].container)
|
||||
this.popupContent.appendChild(this.iosScrollbars[dir].container)
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class Panel extends Container() {
|
|||
|
||||
this.container.classList.add('contains-widgets')
|
||||
|
||||
if (iOS13) {
|
||||
if (iOS13 && this.getProp('scroll')) {
|
||||
|
||||
faderDefaults = faderDefaults || Fader.defaults()._props()
|
||||
|
||||
|
|
@ -291,7 +291,7 @@ class Panel extends Container() {
|
|||
case 'colorBg':
|
||||
this.setCssVariables()
|
||||
case 'colorWidget':
|
||||
if (iOS13) this.checkScrollBars()
|
||||
if (iOS13 && this.getProp('scroll')) this.checkScrollBars()
|
||||
case 'colorText':
|
||||
case 'colorFill':
|
||||
case 'colorStroke':
|
||||
|
|
|
|||
|
|
@ -49,6 +49,10 @@ class FragmentManager {
|
|||
this.deleteFragment(resolvedPath)
|
||||
})
|
||||
|
||||
} else {
|
||||
|
||||
ipc.send('fragmentLoad', {path: path, fileContent: this.fragments[resolvedPath]}, clientId)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,11 +18,19 @@ var midiBinaries = {
|
|||
win32: 'osc-midi-windows.exe'
|
||||
}
|
||||
|
||||
var expectMidiBinaries = false,
|
||||
expectMidiBinariesError = false
|
||||
try {
|
||||
expectMidiBinaries = eval('require("./osc-midi.json")')
|
||||
} catch(e) {}
|
||||
|
||||
var pythonPathOverride
|
||||
if (process.arch === 'x64' && midiBinaries[process.platform]) {
|
||||
var p = path.resolve(__dirname, midiBinaries[process.platform])
|
||||
if (fs.existsSync(p)) {
|
||||
pythonPathOverride = p
|
||||
} else if (expectMidiBinaries) {
|
||||
expectMidiBinariesError = true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -30,6 +38,8 @@ class MidiConverter {
|
|||
|
||||
constructor() {
|
||||
|
||||
if (expectMidiBinariesError) MidiConverter.midiBinariesError()
|
||||
|
||||
this.py = new PythonShell('python/midi.py', Object.assign({
|
||||
args: [
|
||||
'--params',
|
||||
|
|
@ -112,6 +122,8 @@ class MidiConverter {
|
|||
|
||||
static list() {
|
||||
|
||||
if (expectMidiBinariesError) MidiConverter.midiBinariesError()
|
||||
|
||||
PythonShell.run('python/midi.py', Object.assign({pythonPath: MidiConverter.getPythonPath(), args: ['--params', 'list-only']}, pythonOptions), function(e, results) {
|
||||
if (e) {
|
||||
if (e.code === 'ENOENT') {
|
||||
|
|
@ -138,6 +150,14 @@ class MidiConverter {
|
|||
|
||||
}
|
||||
|
||||
static midiBinariesError() {
|
||||
|
||||
console.error(`(ERROR, MIDI) Could not find midi binary file ${p}\nIt may have been deleted by your antivirus.`)
|
||||
console.log('(INFO, MIDI) Falling back to python implementation (see https://openstagecontrol.ammd.net/docs/midi/midi-configuration/).')
|
||||
expectMidiBinariesError = false
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = MidiConverter
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue