Skip to content

Commit

Permalink
add timeout, increase version
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickfrohmann committed Dec 2, 2024
1 parent 4ad40d8 commit ba874f7
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
4 changes: 2 additions & 2 deletions library.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"title": "Virtual3DTour",
"description": "Explore an interactive world in 3D.",
"majorVersion": 1,
"minorVersion": 1,
"patchVersion": 0,
"minorVersion": 0,
"patchVersion": 5,
"runnable": 1,
"author": "codefluegel",
"license": "MIT",
Expand Down
46 changes: 46 additions & 0 deletions scripts/components/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,50 @@ export default class Main extends React.Component {
modelViewerInstance: modelViewer,
animations: modelViewer.availableAnimations,
});
setTimeout(() => {
this.setState({
loadingSpinner: false,
});
}, 5000);
});
setTimeout(() => {
this.setState({
loadingSpinner: false,
});
}, 5000);
}

componentDidUpdate(prevProps, prevState) {
// Check if a specific prop or state has changed to trigger the update logic
const modelViewer = document.getElementById('model-viewer');

if (!modelViewer) {
return;
}

modelViewer.autoRotate = false;

modelViewer.addEventListener('load', () => {
// Create hotspots and set model viewer instance
this.setState({
loadingSpinner: false,
interactions: this.state.interactions,
modelViewerInstance: modelViewer,
animations: modelViewer.availableAnimations,
});

setTimeout(() => {
this.setState({
loadingSpinner: false,
});
}, 500);
console.log(1);
});
setTimeout(() => {
this.setState({
loadingSpinner: false,
});
}, 5000);
}

componentWillUnmount() {
Expand Down Expand Up @@ -94,6 +137,9 @@ export default class Main extends React.Component {

goToStartModel() {
this.navigateToModel(this.context.params.startModelId);
this.setState({
loadingSpinner: false,
});
}

navigateToModel(modelId) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/components/ModelViewer/ModelViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const ModelViewer = (props) => {
const timeoutId = setTimeout(() => {
sethotspots(hotspots);
setFilePath(getSource(modelPath, contentId));
}, 100);
}, 500);

return () => clearTimeout(timeoutId);
}, [hotspots]);
Expand Down

0 comments on commit ba874f7

Please sign in to comment.