From 1002e1ed87b05780a396f1d003b5824fab469957 Mon Sep 17 00:00:00 2001 From: Jordan Santell Date: Wed, 14 Mar 2018 19:21:07 -0700 Subject: [PATCH] Update WebVRPolyfill to 0.10.3 to fix Chrome devicemotion regression and unit change. --- package.json | 2 +- src/index.js | 15 ++++++--------- src/utils/device.js | 2 +- tests/node/test.js | 4 ++++ 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 7aca84bece7..b3dcb514743 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "style-attr": "^1.0.2", "three": "github:supermedium/three.js#r90fixPoseAndRaycaster", "three-bmfont-text": "^2.1.0", - "webvr-polyfill": "^0.9.40" + "webvr-polyfill": "^0.10.3" }, "devDependencies": { "browserify": "^13.1.0", diff --git a/src/index.js b/src/index.js index 41ce94dca63..b047af76284 100644 --- a/src/index.js +++ b/src/index.js @@ -1,16 +1,13 @@ // Check before the polyfill runs. window.hasNativeWebVRImplementation = !!window.navigator.getVRDisplays || !!window.navigator.getVRDevices; -window.WebVRConfig = window.WebVRConfig || { +// WebVR polyfill +var WebVRPolyfill = require('webvr-polyfill'); +window.webvrpolyfill = new WebVRPolyfill({ BUFFER_SCALE: 1, CARDBOARD_UI_DISABLED: true, - ROTATE_INSTRUCTIONS_DISABLED: true, - TOUCH_PANNER_DISABLED: true, - MOUSE_KEYBOARD_CONTROLS_DISABLED: true -}; - -// WebVR polyfill -require('webvr-polyfill'); + ROTATE_INSTRUCTIONS_DISABLED: true +}); var utils = require('./utils/'); @@ -83,7 +80,7 @@ require('./core/a-mixin'); require('./extras/components/'); require('./extras/primitives/'); -console.log('A-Frame Version: 0.8.1 (Date 2018-03-14, Commit #5ead860)'); +console.log('A-Frame Version: 0.8.1 (Date 2018-03-15, Commit #9941383)'); console.log('three Version:', pkg.dependencies['three']); console.log('WebVR Polyfill Version:', pkg.dependencies['webvr-polyfill']); diff --git a/src/utils/device.js b/src/utils/device.js index 7df3dcc12be..8bc36257c3d 100644 --- a/src/utils/device.js +++ b/src/utils/device.js @@ -1,6 +1,6 @@ var vrDisplay; var polyfilledVRDisplay; -var POLYFILL_VRDISPLAY_ID = 'Cardboard VRDisplay (webvr-polyfill)'; +var POLYFILL_VRDISPLAY_ID = 'Cardboard VRDisplay'; if (navigator.getVRDisplays) { navigator.getVRDisplays().then(function (displays) { diff --git a/tests/node/test.js b/tests/node/test.js index 493d6e555fb..11e84745164 100644 --- a/tests/node/test.js +++ b/tests/node/test.js @@ -9,11 +9,15 @@ suite('node acceptance tests', function () { setup(function () { let _window = global.window = jsdom.jsdom().defaultView; global.navigator = _window.navigator; + global.document = _window.document; + global.screen = {}; }); teardown(function () { delete global.window; delete global.navigator; + delete global.document; + delete global.screen; }); test('can run in node', function () {