93 lines
2.0 KiB
JavaScript
93 lines
2.0 KiB
JavaScript
//Annotation Edit Controls
|
|
const addHS = new OO.ui.ButtonWidget({
|
|
icon: 'mapPinAdd',
|
|
label: 'Add annotation',
|
|
invisibleLabel: true,
|
|
class: 'edit-button'
|
|
})
|
|
addHS.on('click', readyAddHotspot)
|
|
addHS.setDisabled(true)
|
|
|
|
const updateHS = new OO.ui.ButtonWidget({
|
|
icon: 'reload',
|
|
label: 'Update annotations',
|
|
invisibleLabel: true
|
|
})
|
|
updateHS.on('click', readMetadata)
|
|
updateHS.setDisabled(true)
|
|
|
|
const deleteHS = new OO.ui.ButtonWidget({
|
|
icon: 'cancel',
|
|
label: 'Delete annotation',
|
|
invisibleLabel: true
|
|
})
|
|
deleteHS.on('click', readyDelHotspot)
|
|
deleteHS.setDisabled(true)
|
|
|
|
const hotspotButtons = new OO.ui.ButtonGroupWidget({
|
|
items: [ addHS, updateHS, deleteHS ]
|
|
})
|
|
|
|
//View Edit Controls
|
|
const downloadViewerImage = new OO.ui.ButtonWidget({
|
|
icon: 'imageAdd',
|
|
label: 'Download current image',
|
|
invisibleLabel: true
|
|
})
|
|
downloadViewerImage.on('click', () => {
|
|
downloadImage(mw.config.values.wgTitle)
|
|
})
|
|
downloadViewerImage.setDisabled(true)
|
|
|
|
const setView = new OO.ui.ButtonWidget({
|
|
icon: 'camera',
|
|
label: 'Set Initial View',
|
|
invisibleLabel: true
|
|
})
|
|
setView.on('click', writeCameraOrbit)
|
|
setView.setDisabled(true)
|
|
|
|
//View Limit Controls
|
|
const setMinYaw = new OO.ui.ButtonWidget({
|
|
label: 'Yaw'
|
|
})
|
|
setMinYaw.on('click', () => {
|
|
limitCameraOrbit('yaw','min')
|
|
})
|
|
|
|
const minLimitButtons = new OO.ui.ButtonGroupWidget({
|
|
items: [ setMinYaw ]
|
|
})
|
|
|
|
|
|
|
|
const setLims = new OO.ui.PopupButtonWidget({
|
|
label: 'Set View Limits',
|
|
icon: 'tableMergeCells',
|
|
popup: {
|
|
$content: $( '<p>Additional options here.</p>' ),
|
|
padded: true,
|
|
align: 'force-left'
|
|
}
|
|
})
|
|
|
|
const cameraButtons = new OO.ui.ButtonGroupWidget({
|
|
items: [ downloadViewerImage, setView ]
|
|
})
|
|
|
|
//Main Menu
|
|
const modelMenu = new OO.ui.HorizontalLayout({
|
|
items: [
|
|
hotspotButtons,
|
|
cameraButtons
|
|
],
|
|
id: 'edit-model-menu'
|
|
})
|
|
|
|
$('#wikiPreview').after(modelMenu.$element)
|
|
|
|
enableMenu = function() {
|
|
modelMenu.items.forEach(group => {
|
|
group.items.forEach(el => el.setDisabled(false))
|
|
});
|
|
} |