Do not resize the canvas while presenting in immersive mode or on mobile#3080
Merged
dmarcos merged 1 commit intoaframevr:masterfrom Sep 22, 2017
Merged
Conversation
dmarcos
reviewed
Sep 22, 2017
| AScene.prototype.resize.restore(); | ||
| sceneEl.camera = { updateProjectionMatrix: function () {} }; | ||
| sceneEl.canvas = document.createElement('canvas'); | ||
| sceneEl.renderer = { setSize: function () {} }; |
Member
There was a problem hiding this comment.
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 () {} };
Contributor
Author
There was a problem hiding this comment.
Good idea, thank you
dmarcos
reviewed
Sep 22, 2017
tests/core/scene/a-scene.test.js
Outdated
| }); | ||
|
|
||
| suite('resize', function () { | ||
| test('resize not in vr updates renderer size', function () { |
Member
There was a problem hiding this comment.
difficult to read. May be better like this? resize renderer when not in vr mode
dmarcos
reviewed
Sep 22, 2017
tests/core/scene/a-scene.test.js
Outdated
| assert.ok(setSizeSpy.called); | ||
| }); | ||
|
|
||
| test('resize in non-immersive vr on desktop updates renderer size', function () { |
Member
There was a problem hiding this comment.
resize renderer when in vr mode in fullscreen presentation (no headset)
dmarcos
reviewed
Sep 22, 2017
tests/core/scene/a-scene.test.js
Outdated
| assert.ok(setSizeSpy.called); | ||
| }); | ||
|
|
||
| test('resize in vr on mobile does not update renderer size', function () { |
Member
There was a problem hiding this comment.
does not resize renderer in vr mode on mobile devices
dmarcos
reviewed
Sep 22, 2017
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 () { |
Member
There was a problem hiding this comment.
does not resize renderer when in vr mode and presenting in a headset
2441322 to
d42670f
Compare
Member
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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