Skip to content

Commit

Permalink
Fix gyroscope false and update to 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
micku7zu committed Dec 28, 2018
1 parent c5fab87 commit b0cc942
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 18 deletions.
13 changes: 10 additions & 3 deletions dist/vanilla-tilt.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var classCallCheck = function (instance, Constructor) {
* Created by Șandor Sergiu (micku7zu) on 1/27/2017.
* Original idea: https://github.com/gijsroge/tilt.js
* MIT License.
* Version 1.6.0
* Version 1.6.1
*/

var VanillaTilt = function () {
Expand Down Expand Up @@ -41,6 +41,7 @@ var VanillaTilt = function () {

this.glare = this.isSettingTrue(this.settings.glare);
this.glarePrerender = this.isSettingTrue(this.settings["glare-prerender"]);
this.gyroscope = this.isSettingTrue(this.settings.gyroscope);

if (this.glare) {
this.prepareGlare();
Expand Down Expand Up @@ -93,11 +94,14 @@ var VanillaTilt = function () {
this.elementListener.addEventListener("mouseenter", this.onMouseEnterBind);
this.elementListener.addEventListener("mousemove", this.onMouseMoveBind);
this.elementListener.addEventListener("mouseleave", this.onMouseLeaveBind);
window.addEventListener("deviceorientation", this.onDeviceOrientationBind);

if (this.glare) {
window.addEventListener("resize", this.onWindowResizeBind);
}

if (this.gyroscope) {
window.addEventListener("deviceorientation", this.onDeviceOrientationBind);
}
};

/**
Expand All @@ -109,7 +113,10 @@ var VanillaTilt = function () {
this.elementListener.removeEventListener("mouseenter", this.onMouseEnterBind);
this.elementListener.removeEventListener("mousemove", this.onMouseMoveBind);
this.elementListener.removeEventListener("mouseleave", this.onMouseLeaveBind);
window.removeEventListener("deviceorientation", this.onDeviceOrientationBind);

if (this.gyroscope) {
window.removeEventListener("deviceorientation", this.onDeviceOrientationBind);
}

if (this.glare) {
window.removeEventListener("resize", this.onWindowResizeBind);
Expand Down
2 changes: 1 addition & 1 deletion dist/vanilla-tilt.babel.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions dist/vanilla-tilt.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var VanillaTilt = (function () {
* Created by Șandor Sergiu (micku7zu) on 1/27/2017.
* Original idea: https://github.com/gijsroge/tilt.js
* MIT License.
* Version 1.6.0
* Version 1.6.1
*/

class VanillaTilt {
Expand All @@ -32,6 +32,7 @@ class VanillaTilt {

this.glare = this.isSettingTrue(this.settings.glare);
this.glarePrerender = this.isSettingTrue(this.settings["glare-prerender"]);
this.gyroscope = this.isSettingTrue(this.settings.gyroscope);

if (this.glare) {
this.prepareGlare();
Expand Down Expand Up @@ -80,11 +81,14 @@ class VanillaTilt {
this.elementListener.addEventListener("mouseenter", this.onMouseEnterBind);
this.elementListener.addEventListener("mousemove", this.onMouseMoveBind);
this.elementListener.addEventListener("mouseleave", this.onMouseLeaveBind);
window.addEventListener("deviceorientation", this.onDeviceOrientationBind);

if (this.glare) {
window.addEventListener("resize", this.onWindowResizeBind);
}

if (this.gyroscope) {
window.addEventListener("deviceorientation", this.onDeviceOrientationBind);
}
}

/**
Expand All @@ -94,7 +98,10 @@ class VanillaTilt {
this.elementListener.removeEventListener("mouseenter", this.onMouseEnterBind);
this.elementListener.removeEventListener("mousemove", this.onMouseMoveBind);
this.elementListener.removeEventListener("mouseleave", this.onMouseLeaveBind);
window.removeEventListener("deviceorientation", this.onDeviceOrientationBind);

if(this.gyroscope) {
window.removeEventListener("deviceorientation", this.onDeviceOrientationBind);
}

if (this.glare) {
window.removeEventListener("resize", this.onWindowResizeBind);
Expand Down
Loading

0 comments on commit b0cc942

Please sign in to comment.