Convert preview menu buld to function
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Use the OOui js library to create wikis-style menu
|
||||||
|
* options on the preview edits page for interaction
|
||||||
|
* with the model
|
||||||
|
*/
|
||||||
|
buildPreviewMenu = function() {
|
||||||
let [_, origMetadata] = extractMetadata()
|
let [_, origMetadata] = extractMetadata()
|
||||||
|
|
||||||
//Annotation Edit Controls
|
//Annotation Edit Controls
|
||||||
@@ -172,6 +178,7 @@ selectVC.getMenu().on( 'choose', selSet => {
|
|||||||
selectViewConfig(selSet.data)
|
selectViewConfig(selSet.data)
|
||||||
})
|
})
|
||||||
selectVC.setDisabled(true)
|
selectVC.setDisabled(true)
|
||||||
|
console.log(selectVC)
|
||||||
|
|
||||||
const cameraButtons = new OO.ui.ButtonGroupWidget({
|
const cameraButtons = new OO.ui.ButtonGroupWidget({
|
||||||
items: [ downloadViewerImage, setControl, setView, setLims, selectVC ]
|
items: [ downloadViewerImage, setControl, setView, setLims, selectVC ]
|
||||||
@@ -188,8 +195,27 @@ const modelMenu = new OO.ui.HorizontalLayout({
|
|||||||
|
|
||||||
$('#wikiPreview').after(modelMenu.$element)
|
$('#wikiPreview').after(modelMenu.$element)
|
||||||
|
|
||||||
|
return [modelMenu, selectVC]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable all the preview menu widgets (called by
|
||||||
|
* model load event)
|
||||||
|
*/
|
||||||
enableMenu = function() {
|
enableMenu = function() {
|
||||||
modelMenu.items.forEach(group => {
|
modelMenu.items.forEach(group => {
|
||||||
group.items.forEach(el => el.setDisabled(false))
|
group.items.forEach(el => el.setDisabled(false))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a selection option to a ButtonMenuSelectWidget
|
||||||
|
*
|
||||||
|
* @param {ButtonMenuSelectWidget} menuWidget
|
||||||
|
*/
|
||||||
|
addMenuOption = function(menuWidget) {
|
||||||
|
menuWidget.menu.addItems([new OO.ui.MenuOptionWidget({data: 'New option', label: 'New option'})])
|
||||||
|
}
|
||||||
|
|
||||||
|
//Initialize the menu and get required global objects
|
||||||
|
const [modelMenu, viewSelector] = buildPreviewMenu()
|
||||||
Reference in New Issue
Block a user