display widgets by category in editor's context menu
This commit is contained in:
parent
6626e1f531
commit
4499ac8c77
2 changed files with 17 additions and 2 deletions
|
|
@ -6,6 +6,7 @@ var data = require('./data-workers'),
|
|||
editSession = edit.editSession,
|
||||
createPopup = require('../utils').createPopup,
|
||||
widgetOptions = require('../widgets').widgetOptions,
|
||||
widgetCategories = require('../widgets').categories,
|
||||
menu = require('./context-menu')
|
||||
|
||||
|
||||
|
|
@ -97,8 +98,13 @@ var init = function(){
|
|||
updateDom(container,data)
|
||||
}
|
||||
}
|
||||
for (widgetType in widgetOptions) {
|
||||
actions['<i class="fa fa-plus"></i> Add widget'][widgetType] = createFunction(widgetType,container,data)
|
||||
for (category in widgetCategories) {
|
||||
actions['<i class="fa fa-plus"></i> Add widget'][category] = {}
|
||||
for (t in widgetCategories[category]) {
|
||||
var type = widgetCategories[category][t]
|
||||
actions['<i class="fa fa-plus"></i> Add widget'][category][type] = createFunction(type,container,data)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,15 @@ module.exports.createWidget = {
|
|||
multifader: multifader.create
|
||||
}
|
||||
|
||||
module.exports.categories = {
|
||||
'Sliders':['fader','knob'],
|
||||
'Buttons':['toggle','push','switch'],
|
||||
'Pads':['xy','rgb'],
|
||||
'Matrix':['multifader','multitoggle','multipush'],
|
||||
'Plots':['led'],
|
||||
'Containers':['panel','strip']
|
||||
}
|
||||
|
||||
module.exports.sync = function() {
|
||||
// Widget that share the same id will update each other
|
||||
// without sending any extra osc message
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue