Fix first onDeviceOrientation call from desktop

This commit is contained in:
Sandor Sergiu 2018-12-23 00:18:17 +02:00
parent a4fb9a99cc
commit 3cf9615b1c
7 changed files with 22 additions and 2 deletions

View file

@ -132,6 +132,10 @@ var VanillaTilt = function () {
};
VanillaTilt.prototype.onDeviceOrientation = function onDeviceOrientation(event) {
if (event.gamma === null || event.beta === null) {
return;
}
this.updateElementPosition();
var totalAngleX = this.settings.gyroscopeMaxAngleX - this.settings.gyroscopeMinAngleX;

File diff suppressed because one or more lines are too long

View file

@ -117,6 +117,10 @@ class VanillaTilt {
}
onDeviceOrientation(event) {
if (event.gamma === null || event.beta === null) {
return;
}
this.updateElementPosition();
const totalAngleX = this.settings.gyroscopeMaxAngleX - this.settings.gyroscopeMinAngleX;

File diff suppressed because one or more lines are too long

View file

@ -114,6 +114,10 @@ class VanillaTilt {
}
onDeviceOrientation(event) {
if (event.gamma === null || event.beta === null) {
return;
}
this.updateElementPosition();
const totalAngleX = this.settings.gyroscopeMaxAngleX - this.settings.gyroscopeMinAngleX;

View file

@ -131,6 +131,10 @@ var VanillaTilt = function () {
};
VanillaTilt.prototype.onDeviceOrientation = function onDeviceOrientation(event) {
if (event.gamma === null || event.beta === null) {
return;
}
this.updateElementPosition();
var totalAngleX = this.settings.gyroscopeMaxAngleX - this.settings.gyroscopeMinAngleX;

View file

@ -114,6 +114,10 @@ export default class VanillaTilt {
}
onDeviceOrientation(event) {
if (event.gamma === null || event.beta === null) {
return;
}
this.updateElementPosition();
const totalAngleX = this.settings.gyroscopeMaxAngleX - this.settings.gyroscopeMinAngleX;