Add set camera limit buttons
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -49,30 +49,80 @@ setView.setDisabled(true)
|
|||||||
|
|
||||||
//View Limit Controls
|
//View Limit Controls
|
||||||
const setMinYaw = new OO.ui.ButtonWidget({
|
const setMinYaw = new OO.ui.ButtonWidget({
|
||||||
label: 'Yaw'
|
label: 'Min'
|
||||||
})
|
})
|
||||||
setMinYaw.on('click', () => {
|
setMinYaw.on('click', () => {
|
||||||
limitCameraOrbit('yaw','min')
|
limitCameraOrbit('yaw','min')
|
||||||
})
|
})
|
||||||
|
|
||||||
const minLimitButtons = new OO.ui.ButtonGroupWidget({
|
const setMaxYaw = new OO.ui.ButtonWidget({
|
||||||
items: [ setMinYaw ]
|
label: 'Max'
|
||||||
|
})
|
||||||
|
setMaxYaw.on('click', () => {
|
||||||
|
limitCameraOrbit('yaw','max')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const yawLimitButtons = new OO.ui.ButtonGroupWidget({
|
||||||
|
items: [ setMinYaw, setMaxYaw ]
|
||||||
|
})
|
||||||
|
|
||||||
|
const labelYaw = new OO.ui.LabelWidget({
|
||||||
|
label: "Yaw:"
|
||||||
|
})
|
||||||
|
|
||||||
|
const yawButtons = new OO.ui.HorizontalLayout({
|
||||||
|
items: [
|
||||||
|
labelYaw,
|
||||||
|
yawLimitButtons
|
||||||
|
],
|
||||||
|
id: 'yaw-limits'
|
||||||
|
})
|
||||||
|
|
||||||
|
const setMinPitch = new OO.ui.ButtonWidget({
|
||||||
|
label: 'Min'
|
||||||
|
})
|
||||||
|
setMinPitch.on('click', () => {
|
||||||
|
limitCameraOrbit('pitch','min')
|
||||||
|
})
|
||||||
|
|
||||||
|
const setMaxPitch = new OO.ui.ButtonWidget({
|
||||||
|
label: 'Max'
|
||||||
|
})
|
||||||
|
setMaxPitch.on('click', () => {
|
||||||
|
limitCameraOrbit('pitch','max')
|
||||||
|
})
|
||||||
|
|
||||||
|
const pitchLimitButtons = new OO.ui.ButtonGroupWidget({
|
||||||
|
items: [ setMinPitch, setMaxPitch ]
|
||||||
|
})
|
||||||
|
|
||||||
|
const labelPitch = new OO.ui.LabelWidget({
|
||||||
|
label: "Pitch:"
|
||||||
|
})
|
||||||
|
|
||||||
|
const pitchButtons = new OO.ui.HorizontalLayout({
|
||||||
|
items: [
|
||||||
|
labelPitch,
|
||||||
|
pitchLimitButtons
|
||||||
|
],
|
||||||
|
id: 'pitch-limits'
|
||||||
|
})
|
||||||
|
|
||||||
const setLims = new OO.ui.PopupButtonWidget({
|
const setLims = new OO.ui.PopupButtonWidget({
|
||||||
label: 'Set View Limits',
|
label: 'Set View Limits',
|
||||||
|
invisibleLabel: true,
|
||||||
icon: 'tableMergeCells',
|
icon: 'tableMergeCells',
|
||||||
popup: {
|
popup: {
|
||||||
$content: $( '<p>Additional options here.</p>' ),
|
$content: yawButtons.$element.add(pitchButtons.$element),
|
||||||
padded: true,
|
padded: true,
|
||||||
align: 'force-left'
|
position: 'above'
|
||||||
}
|
},
|
||||||
|
$overlay: $('#bodyContent')
|
||||||
})
|
})
|
||||||
|
setLims.setDisabled(true)
|
||||||
|
|
||||||
const cameraButtons = new OO.ui.ButtonGroupWidget({
|
const cameraButtons = new OO.ui.ButtonGroupWidget({
|
||||||
items: [ downloadViewerImage, setView ]
|
items: [ downloadViewerImage, setView, setLims ]
|
||||||
})
|
})
|
||||||
|
|
||||||
//Main Menu
|
//Main Menu
|
||||||
|
|||||||
@@ -454,6 +454,7 @@ limitCameraOrbit = function(axis, limit) {
|
|||||||
let oldOrbitVals = (oldOrbit) ? oldOrbit.split(' ') : Array(3).fill('auto')
|
let oldOrbitVals = (oldOrbit) ? oldOrbit.split(' ') : Array(3).fill('auto')
|
||||||
oldOrbitVals[valueIndex] = newOrbitVals[valueIndex]
|
oldOrbitVals[valueIndex] = newOrbitVals[valueIndex]
|
||||||
metadata.viewerConfig.default[`${limit}-camera-orbit`] = oldOrbitVals.join(' ')
|
metadata.viewerConfig.default[`${limit}-camera-orbit`] = oldOrbitVals.join(' ')
|
||||||
|
mView.setAttribute(`${limit}-camera-orbit`, oldOrbitVals.join(' '))
|
||||||
const newText = currentText.replace(/(.*?<pre>)[\S\s]*?(<\/pre>.*)/,`$1\n${JSON.stringify(metadata, null, 2)}\n$2`)
|
const newText = currentText.replace(/(.*?<pre>)[\S\s]*?(<\/pre>.*)/,`$1\n${JSON.stringify(metadata, null, 2)}\n$2`)
|
||||||
$('#wpTextbox1').val(newText)
|
$('#wpTextbox1').val(newText)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user