Include fiedl of view in annotation data
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -32,6 +32,7 @@ clickAddHotspot = function(e) {
|
||||
hsOutput['data-orbit'] = orb2degree(targetModel.getCameraOrbit().toString(),[2,2,5])
|
||||
let targetObj = targetModel.getCameraTarget()
|
||||
hsOutput['data-target'] = `${targetObj.x.toFixed(5)}m ${targetObj.y.toFixed(5)}m ${targetObj.z.toFixed(5)}m`
|
||||
hsOutput['field-of-view'] = Number.parseFloat(targetModel.getFieldOfView()).toFixed(5) + 'deg'
|
||||
mvconfig.annotations['Hotspot ' + (Object.keys(mvconfig.annotations).length + 1)] = hsOutput
|
||||
let newText = currentText.replace(/(.*?<mvconfig>)[\S\s]*?(<\/mvconfig>.*)/,`$1\n${JSON.stringify(mvconfig, null, 2)}\n$2`)
|
||||
$('#wpTextbox1').val(newText)
|
||||
@@ -135,13 +136,16 @@ releaseAnnotation = function(e) {
|
||||
let targetObj = mvEl.getCameraTarget()
|
||||
const newTarg = `${targetObj.x.toFixed(5)}m ${targetObj.y.toFixed(5)}m ${targetObj.z.toFixed(5)}m`
|
||||
e.target.setAttribute('data-target', newTarg)
|
||||
const newFov = Number.parseFloat(mvEl.getFieldOfView()).toFixed(5) + 'deg'
|
||||
e.target.setAttribute('field-of-view', newFov)
|
||||
let currentText = $('#wpTextbox1').val()
|
||||
let [_, mvconfig] = extractMvconfig(currentText)
|
||||
mvconfig.annotations[e.target.childNodes[0].innerText] = {
|
||||
"data-position": newPos,
|
||||
"data-normal": newNorm,
|
||||
"data-orbit": newOrb,
|
||||
"data-target": newTarg
|
||||
"data-target": newTarg,
|
||||
"field-of-view": newFov
|
||||
}
|
||||
const newText = currentText.replace(/(.*?<mvconfig>)[\S\s]*?(<\/mvconfig>.*)/,`$1\n${JSON.stringify(mvconfig, null, 2)}\n$2`)
|
||||
$('#wpTextbox1').val(newText)
|
||||
|
||||
@@ -53,6 +53,8 @@ selectAnnotation = function(mView, annotId) {
|
||||
an.classList.remove('HiddenAnnotation');
|
||||
if (an.parentElement.dataset.target) {mView.cameraTarget = an.parentElement.dataset.target}
|
||||
if (an.parentElement.dataset.orbit) {mView.cameraOrbit = an.parentElement.dataset.orbit}
|
||||
const anFov = an.parentElement.getAttribute('field-of-view')
|
||||
if (anFov) {mView.fieldOfView = anFov}
|
||||
anSelected = true
|
||||
} else {
|
||||
an.classList.add('HiddenAnnotation');
|
||||
|
||||
Reference in New Issue
Block a user