Skip to content

Commit dd354f6

Browse files
authored
fixed two examples bugs (#4932)
* fixed two examples bugs * hiding the lines * simplify
1 parent db15d9f commit dd354f6

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

packages/modelviewer.dev/examples/annotations/index.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,26 @@ <h4 id="intro"><span class="font-medium">Animated Hotspots. </span></h4>
174174
let tailRect;
175175

176176
function onResize(){
177-
baseRect = modelViewer1.getBoundingClientRect();
177+
const arStatus = modelViewer1.getAttribute('ar-status');
178+
baseRect = (arStatus == "not-presenting" || arStatus == "failed") ?
179+
modelViewer1.getBoundingClientRect() : new DOMRect();
178180
noseRect = document.querySelector('#nose').getBoundingClientRect();
179181
hoofRect = document.querySelector('#hoof').getBoundingClientRect();
180182
tailRect = document.querySelector('#tail').getBoundingClientRect();
181183
}
182184

183185
window.addEventListener("resize", onResize);
184186

185-
modelViewer1.addEventListener('ar-status', onResize);
187+
modelViewer1.addEventListener('ar-status', (event) => {
188+
lines.forEach((element) => {
189+
if (event.detail.status !== 'session-started') {
190+
element.classList.remove('hide');
191+
} else {
192+
element.classList.add('hide');
193+
}
194+
});
195+
onResize();
196+
});
186197

187198
modelViewer1.addEventListener('load', () => {
188199
onResize();

packages/modelviewer.dev/examples/postprocessing/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ <h2 class="demo-title">Combining Effects</h2>
305305
</div>
306306
<example-snippet stamp-to="combining-effects" highlight-as="html">
307307
<template>
308-
<model-viewer id="effectsViewer" camera-controls touch-action="pan-y" src="../../shared-assets/models/EmissiveStrengthTest.glb" ar alt="A 3D ">
308+
<model-viewer id="effectsViewer" camera-controls scale="0.1 0.1 0.1" touch-action="pan-y" src="../../shared-assets/models/EmissiveStrengthTest.glb" ar alt="A 3D ">
309309
<effect-composer render-mode="quality">
310310
<outline-effect color="blue" blend-mode="skip"></outline-effect>
311311
<ssao-effect blend-mode="skip"></ssao-effect>

0 commit comments

Comments
 (0)