Skip to content

Commit

Permalink
fixed two examples bugs (#4932)
Browse files Browse the repository at this point in the history
* fixed two examples bugs

* hiding the lines

* simplify
  • Loading branch information
elalish authored Nov 8, 2024
1 parent db15d9f commit dd354f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions packages/modelviewer.dev/examples/annotations/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,26 @@ <h4 id="intro"><span class="font-medium">Animated Hotspots. </span></h4>
let tailRect;

function onResize(){
baseRect = modelViewer1.getBoundingClientRect();
const arStatus = modelViewer1.getAttribute('ar-status');
baseRect = (arStatus == "not-presenting" || arStatus == "failed") ?
modelViewer1.getBoundingClientRect() : new DOMRect();
noseRect = document.querySelector('#nose').getBoundingClientRect();
hoofRect = document.querySelector('#hoof').getBoundingClientRect();
tailRect = document.querySelector('#tail').getBoundingClientRect();
}

window.addEventListener("resize", onResize);

modelViewer1.addEventListener('ar-status', onResize);
modelViewer1.addEventListener('ar-status', (event) => {
lines.forEach((element) => {
if (event.detail.status !== 'session-started') {
element.classList.remove('hide');
} else {
element.classList.add('hide');
}
});
onResize();
});

modelViewer1.addEventListener('load', () => {
onResize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ <h2 class="demo-title">Combining Effects</h2>
</div>
<example-snippet stamp-to="combining-effects" highlight-as="html">
<template>
<model-viewer id="effectsViewer" camera-controls touch-action="pan-y" src="../../shared-assets/models/EmissiveStrengthTest.glb" ar alt="A 3D ">
<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 ">
<effect-composer render-mode="quality">
<outline-effect color="blue" blend-mode="skip"></outline-effect>
<ssao-effect blend-mode="skip"></ssao-effect>
Expand Down

0 comments on commit dd354f6

Please sign in to comment.