Skip to content

Commit

Permalink
Add URL query params for hiding UI and camera settings
Browse files Browse the repository at this point in the history
  • Loading branch information
UX3D-haertl committed Oct 18, 2024
1 parent 455569e commit 4fe509d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<div class="canvasUIMaximize">
<img v-bind:src="[fullscreen ? 'assets/ui/Icon_Collapse.svg' : 'assets/ui/Icon_Expand.svg']"
@click="toggleUI()" ref="fullscreenIcon" class="maximizeCanvasIcon" width="30px"
v-show='!(isMobile && tabContentHidden === false)'
v-show='!(isMobile && tabContentHidden === false) && !noUI'
>
</div>
<div class="column " v-show='uiVisible'>
Expand Down
5 changes: 5 additions & 0 deletions src/logic/uimodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ class UIModel
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const modelURL = urlParams.get("model");
const noUI = urlParams.get("noUI");
if (noUI !== null) {
this.app.uiVisible = false;
this.app.noUI = true;
}

this.scene = app.sceneChanged.pipe();
this.camera = app.cameraChanged.pipe();
Expand Down
10 changes: 10 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ export default async () => {
state.userCamera.perspective.aspectRatio = canvas.width / canvas.height;
state.userCamera.resetView(state.gltf, state.sceneIndex);

const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
let yaw = urlParams.get("yaw") ?? 0;
yaw = yaw * (Math.PI / 180) / state.userCamera.orbitSpeed;
let pitch = urlParams.get("pitch") ?? 0;
pitch = pitch * (Math.PI / 180) / state.userCamera.orbitSpeed;
const distance = urlParams.get("distance") ?? 0;
state.userCamera.orbit(yaw, pitch);
state.userCamera.zoomBy(distance);

// Try to start as many animations as possible without generating conficts.
state.animationIndices = [];
for (let i = 0; i < gltf.animations.length; i++) {
Expand Down

0 comments on commit 4fe509d

Please sign in to comment.