editor: hide impossible actions from context-menu (eg adding widgets in tab containers)

This commit is contained in:
bordun 2020-09-21 10:52:30 +02:00
parent d5a6263591
commit fa39e3889a
3 changed files with 29 additions and 21 deletions

View file

@ -1,5 +1,10 @@
# Changelog
## 1.2.2
- bug fixes
- editor: hide impossible actions from context-menu (eg adding widgets in tab containers)
## 1.2.1
- scripting

View file

@ -2,7 +2,7 @@
"name": "open-stage-control",
"productName": "Open Stage Control",
"description": "Libre and modular OSC / MIDI controller",
"version": "1.2.1",
"version": "1.2.2",
"author": {
"name": "Jean-Emmanuel Doucet",
"email": "jean-emmanuel@ammd.net"

View file

@ -182,29 +182,32 @@ var handleClick = function(event) {
separator: true
})
actions.push({
label: icon('plus') + ' ' + locales('editor_addwidget'),
action: addActions
})
if (data.length == 1 && widget.childrenType !== 'tab') {
actions.push({
label: icon('plus') + ' ' + locales('editor_addwidget'),
action: addActions
})
}
if (data.length == 1 && widget.childrenType !== 'widget') {
actions.push({
label: icon('plus') + ' ' + locales('editor_addtab'),
action: ()=>{
data[0].tabs = data[0].tabs || []
data[0].tabs.push({})
var indexes = {addedIndexes: [data[0].tabs.length -1]}
updateWidget(editor.selectedWidgets[0], indexes)
editor.pushHistory(indexes)
}
})
}
}
if (data.length == 1 && (!data[0].widgets || !data[0].widgets.length) && (data[0].tabs)) {
actions.push({
label: icon('plus') + ' ' + locales('editor_addtab'),
action: ()=>{
data[0].tabs = data[0].tabs || []
data[0].tabs.push({})
var indexes = {addedIndexes: [data[0].tabs.length -1]}
updateWidget(editor.selectedWidgets[0], indexes)
editor.pushHistory(indexes)
}
})
}
if (parent !== widgetManager) {