Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/core/scene/a-scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ module.exports = registerElement('a-scene', {
// Don't exit VR if not in VR.
if (!this.is('vr-mode')) { return Promise.resolve('Not in VR.'); }

exitFullscreen();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should call this after the not-in-VR check below

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it won't work. Just entering fullscreen does not set the state to vr-mode

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep


if (this.checkHeadsetConnected() || this.isMobile) {
return this.effect.exitPresent().then(exitVRSuccess, exitVRFailure);
}
Expand Down Expand Up @@ -489,3 +491,13 @@ function requestFullscreen (canvas) {
canvas.msRequestFullscreen;
requestFullscreen.apply(canvas);
}

function exitFullscreen () {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
}