exchange x y axis if view is rotated on DeviceMotionEvent (#2788)

fix babel


commit
This commit is contained in:
PP
2018-06-01 16:09:09 +08:00
committed by pandamicro
parent 8f07ff1267
commit ec3798b097
@@ -146,6 +146,11 @@ inputManager.didAccelerate = function (eventData) {
z = (eventData["alpha"] / 90) * 0.981;
}
if (cc.view._isRotated) {
let tmp = x;
x = -y;
y = tmp;
}
mAcceleration.x = x;
mAcceleration.y = y;
mAcceleration.z = z;