Add set starting view button
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -97,11 +97,17 @@ class GlModelHooks {
|
|||||||
'onclick' => 'downloadImage("' . $title . '")'
|
'onclick' => 'downloadImage("' . $title . '")'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$orbButtonAttr = array(
|
||||||
|
'class' => 'preview-button SetOrbit',
|
||||||
|
'onclick' => 'writeCameraOrbit()'
|
||||||
|
);
|
||||||
|
|
||||||
$addHsButton = array(
|
$addHsButton = array(
|
||||||
Html::rawElement('button',$addButtonAttr,'Add a new hotspot'),
|
Html::rawElement('button',$addButtonAttr,'Add a new hotspot'),
|
||||||
Html::rawElement('button',$readButtonAttr,'Update hotspots'),
|
Html::rawElement('button',$readButtonAttr,'Update hotspots'),
|
||||||
Html::rawElement('button',$delButtonAttr,'Delete hotspot'),
|
Html::rawElement('button',$delButtonAttr,'Delete hotspot'),
|
||||||
Html::rawElement('button',$dldButtonAttr,'Download image')
|
Html::rawElement('button',$dldButtonAttr,'Download image'),
|
||||||
|
Html::rawElement('button',$orbButtonAttr,'Set start view')
|
||||||
);
|
);
|
||||||
|
|
||||||
$previewHTML = Html::rawElement('div',NULL,$previewViewer.implode($addHsButton));
|
$previewHTML = Html::rawElement('div',NULL,$previewViewer.implode($addHsButton));
|
||||||
|
|||||||
@@ -426,4 +426,15 @@ toggleFullScreen = function(glCont) {
|
|||||||
} else {
|
} else {
|
||||||
glCont.requestFullscreen()
|
glCont.requestFullscreen()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send new default camera orbit values to the preview editor
|
||||||
|
*/
|
||||||
|
writeCameraOrbit = function() {
|
||||||
|
const mView = $('model-viewer')[0]
|
||||||
|
let newOrbit = mView.getCameraOrbit().toString()
|
||||||
|
newOrbit = newOrbit.replaceAll(/(\d{2})(\d*?rad)/g,"$1rad")
|
||||||
|
const textUpdate = $('#wpTextbox1').val().replace(/([\S\s]*?default[\S\s]*?"camera-orbit": ")(.*?)(",$[\S\s]*)/gm,'$1' + newOrbit + '$3')
|
||||||
|
$('#wpTextbox1').val(textUpdate)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user