mirror of
https://github.com/apache/cordova-plugin-screen-orientation.git
synced 2025-05-05 01:32:59 +08:00
improved the orientation change method
This commit is contained in:
parent
1f536ec80e
commit
f8c75e341a
@ -94,22 +94,8 @@
|
|||||||
orientationChange();
|
orientationChange();
|
||||||
|
|
||||||
function orientationChange() {
|
function orientationChange() {
|
||||||
switch (window.orientation) {
|
screen.orientation.type = window.OrientationType[window.orientation];
|
||||||
case 0:
|
|
||||||
screen.orientation.type = window.OrientationType['0']; //append angle here ?
|
|
||||||
break;
|
|
||||||
case 90:
|
|
||||||
screen.orientation.type = window.OrientationType['90'];
|
|
||||||
break;
|
|
||||||
case 180:
|
|
||||||
screen.orientation.type = window.OrientationType['180'];
|
|
||||||
break;
|
|
||||||
case -90:
|
|
||||||
screen.orientation.type = window.OrientationType['-90'];
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
screen.orientation.type = window.OrientationType['0'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
window.addEventListener("orientationchange", orientationChange, true);
|
window.addEventListener("orientationchange", orientationChange, true);
|
||||||
module.exports = screenOrientation;
|
module.exports = screenOrientation;
|
Loading…
x
Reference in New Issue
Block a user