Skip to content
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

Moves canvas initialization logic from a component to the scene. This… #2985

Merged
merged 1 commit into from
Aug 24, 2017

Conversation

dmarcos
Copy link
Member

@dmarcos dmarcos commented Aug 17, 2017

… handle the case when calling enterVR before the renderer is initialized and also moves the canvas and renderer initialization before assets load (it's not a component anymore). This is a prequesite for a loading screen / spinner

Description:

Changes proposed:

@@ -385,7 +385,7 @@ suite('a-scene (without renderer)', function () {
var sceneEl = this.el;
sceneEl.innerHTML = 'NEW';
sceneEl.reload();
assert.equal(sceneEl.innerHTML, '');
assert.equal(sceneEl.innerHTML, '<canvas class="a-canvas" data-aframe-canvas="true"></canvas>');
Copy link
Member

Choose a reason for hiding this comment

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

We can do a more robust test with query selector rather than string check.

@@ -449,6 +450,46 @@ module.exports.AScene = registerElement('a-scene', {
writable: window.debug
},

setupCanvas: {
Copy link
Member

Choose a reason for hiding this comment

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

We could move this out of the prototype to pure function. setupCanvas (sceneEl).

// Set canvas on scene.
sceneEl.canvas = canvasEl;
sceneEl.emit('render-target-loaded', {target: canvasEl});
// For unknown reasons a syncrhonous resize does not work on desktop when
Copy link
Member

Choose a reason for hiding this comment

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

can fix this typo on synchronous

@ngokevin
Copy link
Member

r+wc

@machenmusik
Copy link
Contributor

FYI - this does not solve #2967

@dmarcos
Copy link
Member Author

dmarcos commented Aug 23, 2017

Yes, the vrdisplayactivate event handler has to be attached earlier: when AFRAME loads instead of when a-scene initializes. It's a separate problem

@machenmusik
Copy link
Contributor

Ok tell you what, since I think we both agree solution to #2967 based on this would be better than current #2966, let me try to redo that on top of this PR. May take a while for me to get to it

… handle the case when calling enterVR before the renderer is initialized and also moves the canvas and renderer initialization before assets load (it's not a component anymore). This is a prequesite for a loading screen / spinner
dmarcos pushed a commit that referenced this pull request Aug 24, 2017
…traversal in Oculus Browser) (#2991)

* Moves canvas initialization logic from a component to the scene. This handle the case when calling enterVR before the renderer is initialized and also moves the canvas and renderer initialization before assets load (it's not a component anymore). This is a prequesite for a loading screen / spinner

* add vrdisplayactivate handler earlier than previously, as Oculus Browser fires it quite early on

* remove redundant vrdisplayactivate listener in a-scene; improve comments
dmarcos added a commit that referenced this pull request Aug 24, 2017
…(vr2vr traversal in Oculus Browser) (#2991)"

This reverts commit 5214a16.
dmarcos added a commit that referenced this pull request Aug 24, 2017
…(vr2vr traversal in Oculus Browser)" (#2995)

* Revert "Update master CDN URL. (https://rawgit.com/aframevr/aframe/fad376f/dist/aframe-master.min.js)"

This reverts commit d576691.

* Revert "Bump aframe-master dist/ builds. (c9c7bfc...5214a16)"

This reverts commit fad376f.

* Revert "extend PR #2985 (moved canvas init) to also solve issue #2967 (vr2vr traversal in Oculus Browser) (#2991)"

This reverts commit 5214a16.
@dmarcos dmarcos merged commit 412d162 into aframevr:master Aug 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants