Skip to content

Commit

Permalink
Fixing window orientation problems on fast mode, future proofing hand…
Browse files Browse the repository at this point in the history
…lers
  • Loading branch information
paulbrzeski committed May 6, 2024
1 parent 0fdc34b commit cc95f1d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 27 deletions.
48 changes: 24 additions & 24 deletions docs/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/app/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function handleViewportChange() {
window.virtual_office.renderers.webgl.setSize(width, height);


if (window.virtual_office.effects.passes.length > 0)
if (window.virtual_office.effects && window.virtual_office.effects.passes.length > 0)
window.virtual_office.effects.setSize(width, height);

window.virtual_office.camera.aspect = width / height;
Expand Down
9 changes: 7 additions & 2 deletions src/app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,13 @@ export default async function init() {
document.body.appendChild(stats.dom);
}


window.addEventListener('orientationchange', handleViewportChange);
if ( screen && screen.orientation ) {
screen.orientation.addEventListener('change', handleViewportChange);
}
else {
window.addEventListener('orientationchange', handleViewportChange);
}

window.addEventListener('resize', handleViewportChange);

document.getElementById('exitSign').addEventListener('click', handleExitSign);
Expand Down

0 comments on commit cc95f1d

Please sign in to comment.