diff --git a/package.json b/package.json index 25ed65d0014..ac14c011444 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "style-attr": "^1.0.2", "three": "^0.87.0", "three-bmfont-text": "^2.1.0", - "webvr-polyfill": "^0.10.3" + "webvr-polyfill": "0.10.3" }, "devDependencies": { "browserify": "^13.1.0", diff --git a/src/index.js b/src/index.js index 420006ac555..e6cfbf98f85 100644 --- a/src/index.js +++ b/src/index.js @@ -26,13 +26,13 @@ window.Promise = window.Promise || require('promise-polyfill'); // 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 -}; + ROTATE_INSTRUCTIONS_DISABLED: true +}); // Workaround for iOS Safari canvas sizing issues in stereo (webvr-polyfill/issues/102). // Only for iOS on versions older than 10. @@ -40,9 +40,6 @@ if (utils.device.isIOSOlderThan10(window.navigator.userAgent)) { window.WebVRConfig.BUFFER_SCALE = 1 / window.devicePixelRatio; } -// WebVR polyfill -require('webvr-polyfill'); - require('present'); // Polyfill `performance.now()`. // CSS.