diff --git a/includes/GlModelTransformOutput.php b/includes/GlModelTransformOutput.php index e54494b..c169e85 100644 --- a/includes/GlModelTransformOutput.php +++ b/includes/GlModelTransformOutput.php @@ -100,7 +100,8 @@ class GlModelTransformOutput extends MediaTransformOutput { foreach($annotations as $label => $an) { $elAnnot = Html::rawElement('div',['class' => 'HotspotAnnotation HiddenAnnotation'],$label); $hsDefault = array( - 'class' => 'Hotspot', + 'class' => 'Hotspot awaiting-model', + 'style' => 'display: none;', 'slot' => 'hotspot-'.(count($hotspots) +1), 'ontouchstart' => 'event.stopPropagation()', 'onclick' => 'onAnnotation(event)' @@ -125,6 +126,7 @@ class GlModelTransformOutput extends MediaTransformOutput { //Add important additional attributes and render model-viewer with hotspots $attrModelView = array_merge(['src' => $srcUrl, 'class' => 'mv-model', 'interpolation-decay' => '100', 'interaction-prompt' => 'none'], $attrModelView); $attrModelView['style'] = 'width: 100%; height: 100%;'; + $attrModelView['onload'] = 'modelLoaded()'; $hotspotHtml = (isset($hotspots)) ? implode($hotspots) : ''; $elModel = Html::rawElement('model-viewer', $attrModelView, $hotspotHtml); @@ -148,7 +150,8 @@ class GlModelTransformOutput extends MediaTransformOutput { */ private static function buildViewMenu() { $attrMenu = array( - 'class' => 'glmv-menu' + 'class' => 'glmv-menu awaiting-model', + 'style' => 'display: none;' ); $mainConfig = ConfigFactory::getDefaultInstance()->makeConfig( 'main' ); $menuUrl = $mainConfig->get( 'ExtensionAssetsPath' ) . '/GlModelViewer/resources/menu_arrow.svg'; @@ -188,10 +191,10 @@ class GlModelTransformOutput extends MediaTransformOutput { 'ontouchstart' => 'event.stopPropagation()' ); $menuButtons = array( - Html::rawElement('div', $attrMenuButtonPrev, ''), - Html::rawElement('div', $attrMenuButtonSlides, ''), - Html::rawElement('div', $attrMenuButtonNext, ''), - Html::rawElement('div', $attrMenuButtonHide, '') + Html::rawElement('div', $attrMenuButtonPrev, ''), + Html::rawElement('div', $attrMenuButtonSlides, ''), + Html::rawElement('div', $attrMenuButtonNext, ''), + Html::rawElement('div', $attrMenuButtonHide, '') ); return Html::rawElement('div', $attrMenu, $menuImg . implode($menuButtons)); diff --git a/modules/glmv.js b/modules/glmv.js index 000badc..6010543 100644 --- a/modules/glmv.js +++ b/modules/glmv.js @@ -1,6 +1,10 @@ let slideShowInterval = null let grabHotspot = null +modelLoaded = function() { + $('.awaiting-model').css('display', 'flex').removeClass('awaiting-model') +} + /** * Sets listener and attributes on model-viewer to * allow for click registering of a new hotspot