-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Do not resize the canvas while presenting in immersive mode or on mobile #3080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| AScene.prototype.resize.restore(); | ||
| sceneEl.camera = { updateProjectionMatrix: function () {} }; | ||
| sceneEl.canvas = document.createElement('canvas'); | ||
| sceneEl.renderer = { setSize: function () {} }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code bellow is common to all the tests in the suite. Can we factor it out to a setup function? e.g: https://github.com/aframevr/aframe/blob/master/tests/core/scene/a-scene.test.js#L214
var sceneEl = this.el;
AScene.prototype.resize.restore();
sceneEl.camera = { updateProjectionMatrix: function () {} };
sceneEl.canvas = document.createElement('canvas');
sceneEl.renderer = { setSize: function () {} };There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, thank you
tests/core/scene/a-scene.test.js
Outdated
| }); | ||
|
|
||
| suite('resize', function () { | ||
| test('resize not in vr updates renderer size', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
difficult to read. May be better like this? resize renderer when not in vr mode
tests/core/scene/a-scene.test.js
Outdated
| assert.ok(setSizeSpy.called); | ||
| }); | ||
|
|
||
| test('resize in non-immersive vr on desktop updates renderer size', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resize renderer when in vr mode in fullscreen presentation (no headset)
tests/core/scene/a-scene.test.js
Outdated
| assert.ok(setSizeSpy.called); | ||
| }); | ||
|
|
||
| test('resize in vr on mobile does not update renderer size', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does not resize renderer in vr mode on mobile devices
tests/core/scene/a-scene.test.js
Outdated
| assert.notOk(setSizeSpy.called); | ||
| }); | ||
|
|
||
| test('resize in immersive vr (while presenting) does not update renderer size', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does not resize renderer when in vr mode and presenting in a headset
2441322 to
d42670f
Compare
|
Thank you! |
Renderer size should only be updated on desktop in fullscreen mode.
Resizing the browser window while presenting leads to the canvas being resized accordingly, which updates resolution in the headset, causing a bad experience. Since Aframe does not rely on Three.js built-in mechanism for resizing the canvas this needs to be handled explicitly in a-scene.js.
Alternative to #3075, follow-up of #3031