cardboard-vr-display
Advanced tools
Comparing version 1.0.13 to 1.0.14
{ | ||
"name": "cardboard-vr-display", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"homepage": "https://github.com/immersive-web/cardboard-vr-display", | ||
@@ -12,6 +12,6 @@ "authors": [ | ||
"devDependencies": { | ||
"babel-core": "^6.24.1", | ||
"babel-core": "^6.26.3", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-env": "^1.7.0", | ||
"rollup": "^0.50.0", | ||
@@ -44,4 +44,4 @@ "rollup-plugin-babel": "^3.0.2", | ||
"nosleep.js": "^0.7.0", | ||
"webvr-polyfill-dpdb": "^1.0.7" | ||
"webvr-polyfill-dpdb": "^1.0.9" | ||
} | ||
} |
@@ -57,2 +57,3 @@ # cardboard-vr-display | ||
will fall back to using devicemotion if in iframes. | ||
* Using Sensors in a cross-origin iframe [requires the frame to be in focus](https://www.w3.org/TR/generic-sensor/#focused-area). In builds of Chrome prior to M69, this logic is [erroneously reversed](https://bugs.chromium.org/p/chromium/issues/detail?id=849501). If loading content via cross-origin iframe, you can disable Sensors, triggering the `devicemotion` fallback with this [hacky workaround](https://github.com/immersive-web/cardboard-vr-display/blob/c196e15a8c7ccf594fe6a5044fbdcb51cc2eff91/examples/index.html#L117-L124). More info in [#27](https://github.com/immersive-web/cardboard-vr-display/issues/27). | ||
@@ -137,5 +138,2 @@ ### Magic Window | ||
// Flag to enable touch panner. In case you have your own touch controls. | ||
TOUCH_PANNER_DISABLED: true, | ||
// Flag to disabled the UI in VR Mode. | ||
@@ -142,0 +140,0 @@ CARDBOARD_UI_DISABLED: false, |
@@ -27,13 +27,2 @@ /* | ||
let orientation = {}; | ||
if (screen.orientation) { | ||
orientation = screen.orientation; | ||
} else if (screen.msOrientation) { | ||
orientation = screen.msOrientation; | ||
} else { | ||
Object.defineProperty(orientation, 'angle', { | ||
get: () => { return (window.orientation || 0); } | ||
}); | ||
} | ||
// Quaternion to rotate from sensor coordinates to WebVR coordinates | ||
@@ -65,3 +54,2 @@ const SENSOR_TO_VR = new Quaternion(); | ||
this._sensorQ = new Quaternion(); | ||
this._worldToScreenQ = new Quaternion(); | ||
this._outQ = new Quaternion(); | ||
@@ -71,5 +59,3 @@ | ||
this._onSensorError = this._onSensorError.bind(this); | ||
this._onOrientationChange = this._onOrientationChange.bind(this); | ||
this._onOrientationChange(); | ||
this.init(); | ||
@@ -92,3 +78,10 @@ } | ||
try { | ||
sensor = new RelativeOrientationSensor({ frequency: SENSOR_FREQUENCY }); | ||
sensor = new RelativeOrientationSensor({ | ||
frequency: SENSOR_FREQUENCY, | ||
// Use `referenceFrame: screen` so we don't have to manage the orientation | ||
// of the device. First available in Chrome m66 (in release at time of writing), | ||
// and this will fail in earlier versions, kicking off `devicemotion` fallback. | ||
// @see https://w3c.github.io/accelerometer/#screen-coordinate-system | ||
referenceFrame: 'screen', | ||
}); | ||
sensor.addEventListener('error', this._onSensorError); | ||
@@ -121,4 +114,2 @@ } catch (error) { | ||
} | ||
window.addEventListener('orientationchange', this._onOrientationChange); | ||
} | ||
@@ -157,3 +148,2 @@ | ||
out.multiply(this._sensorQ); | ||
out.multiply(this._worldToScreenQ); | ||
@@ -187,7 +177,2 @@ // Handle the yaw-only case. | ||
_onSensorRead() {} | ||
_onOrientationChange() { | ||
const angle = -orientation.angle * Math.PI / 180; | ||
this._worldToScreenQ.setFromAxisAngle(Z_AXIS, angle); | ||
} | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
421246
7673
216
Updatedwebvr-polyfill-dpdb@^1.0.9