smartphoto
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -139,5 +139,4 @@ 'use strict'; | ||
window.addEventListener("deviceorientation", function (e) { | ||
var originalEvent = e.originalEvent || e; | ||
var orientation = window.orientation; | ||
if (!originalEvent || !originalEvent.gamma || _this.data.appearEffect) { | ||
if (!e || !e.gamma || _this.data.appearEffect) { | ||
return; | ||
@@ -147,9 +146,9 @@ } | ||
if (orientation === 0) { | ||
_this._calcGravity(originalEvent.gamma, originalEvent.beta); | ||
_this._calcGravity(e.gamma, e.beta); | ||
} else if (orientation === 90) { | ||
_this._calcGravity(originalEvent.beta, originalEvent.gamma); | ||
_this._calcGravity(e.beta, e.gamma); | ||
} else if (orientation === -90) { | ||
_this._calcGravity(-originalEvent.beta, -originalEvent.gamma); | ||
_this._calcGravity(-e.beta, -e.gamma); | ||
} else if (orientation === 180) { | ||
_this._calcGravity(-originalEvent.gamma, -originalEvent.beta); | ||
_this._calcGravity(-e.gamma, -e.beta); | ||
} | ||
@@ -439,7 +438,7 @@ } | ||
if (this._isTouched(event)) { | ||
x = event.originalEvent.touches[0].pageX; | ||
y = event.originalEvent.touches[0].pageY; | ||
x = event.touches[0].pageX; | ||
y = event.touches[0].pageY; | ||
} else if (this._isTouched(this.e)) { | ||
x = this.e.originalEvent.touches[0].pageX; | ||
y = this.e.originalEvent.touches[0].pageY; | ||
x = this.e.touches[0].pageX; | ||
y = this.e.touches[0].pageY; | ||
} else if (event.pageX) { | ||
@@ -454,3 +453,3 @@ x = event.pageX; | ||
value: function _getGesturePos(e) { | ||
var touches = e.originalEvent.touches; | ||
var touches = e.touches; | ||
return [{ x: touches[0].pageX, y: touches[0].pageY }, { x: touches[1].pageX, y: touches[1].pageY }]; | ||
@@ -942,3 +941,3 @@ } | ||
value: function _isTouched(e) { | ||
if (e && e.originalEvent && e.originalEvent.touches) { | ||
if (e && e.touches) { | ||
return true; | ||
@@ -952,3 +951,3 @@ } else { | ||
value: function _isGestured(e) { | ||
if (e && e.originalEvent && e.originalEvent.touches && e.originalEvent.touches.length > 1) { | ||
if (e && e.touches && e.touches.length > 1) { | ||
return true; | ||
@@ -955,0 +954,0 @@ } else { |
{ | ||
"name": "smartphoto", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "smartphoto", | ||
@@ -5,0 +5,0 @@ "homepage": "http://developer.a-blogcms.jp", |
@@ -120,5 +120,4 @@ import aTemplate from 'a-template'; | ||
window.addEventListener("deviceorientation", (e) => { | ||
let originalEvent = e.originalEvent || e; | ||
const orientation = window.orientation; | ||
if(!originalEvent || !originalEvent.gamma || this.data.appearEffect){ | ||
if(!e || !e.gamma || this.data.appearEffect){ | ||
return; | ||
@@ -128,9 +127,9 @@ } | ||
if (orientation === 0) { | ||
this._calcGravity(originalEvent.gamma, originalEvent.beta); | ||
this._calcGravity(e.gamma, e.beta); | ||
} else if (orientation === 90) { | ||
this._calcGravity(originalEvent.beta, originalEvent.gamma); | ||
this._calcGravity(e.beta, e.gamma); | ||
} else if (orientation === -90) { | ||
this._calcGravity(-originalEvent.beta, -originalEvent.gamma); | ||
this._calcGravity(-e.beta, -e.gamma); | ||
} else if (orientation === 180) { | ||
this._calcGravity(-originalEvent.gamma, -originalEvent.beta); | ||
this._calcGravity(-e.gamma, -e.beta); | ||
} | ||
@@ -389,7 +388,7 @@ } | ||
if (this._isTouched(event)) { | ||
x = event.originalEvent.touches[0].pageX; | ||
y = event.originalEvent.touches[0].pageY; | ||
x = event.touches[0].pageX; | ||
y = event.touches[0].pageY; | ||
} else if (this._isTouched(this.e)) { | ||
x = this.e.originalEvent.touches[0].pageX; | ||
y = this.e.originalEvent.touches[0].pageY; | ||
x = this.e.touches[0].pageX; | ||
y = this.e.touches[0].pageY; | ||
} else if(event.pageX){ | ||
@@ -403,3 +402,3 @@ x = event.pageX; | ||
_getGesturePos (e) { | ||
const touches = e.originalEvent.touches; | ||
const touches = e.touches; | ||
return [ | ||
@@ -855,3 +854,3 @@ { x: touches[0].pageX, y: touches[0].pageY}, | ||
_isTouched (e) { | ||
if (e && e.originalEvent && e.originalEvent.touches) { | ||
if (e && e.touches) { | ||
return true; | ||
@@ -864,3 +863,3 @@ } else { | ||
_isGestured (e) { | ||
if (e && e.originalEvent && e.originalEvent.touches && e.originalEvent.touches.length > 1) { | ||
if (e && e.touches && e.touches.length > 1) { | ||
return true; | ||
@@ -867,0 +866,0 @@ } else { |
Sorry, the diff of this file is too big to display
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
7214123
7991