mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-06 03:22:39 +08:00
exchange x y axis if view is rotated on DeviceMotionEvent (#2788)
fix babel commit
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user