mirror of
https://github.com/apache/cordova-plugin-screen-orientation.git
synced 2025-05-05 01:32:59 +08:00
Merge branch 'kevinwang20120702-patch-3'
This commit is contained in:
commit
abc38a52cb
@ -12,24 +12,26 @@ window.shouldRotateToOrientation = function(orientation) {
|
|||||||
var currOrientation = cordova.plugins.screenorientation.currOrientation;
|
var currOrientation = cordova.plugins.screenorientation.currOrientation;
|
||||||
switch (currOrientation) {
|
switch (currOrientation) {
|
||||||
case 'portrait':
|
case 'portrait':
|
||||||
|
if (orientation === 0 || orientation === 180) return true;
|
||||||
|
break;
|
||||||
case 'portrait-primary':
|
case 'portrait-primary':
|
||||||
if (orientation === 0) return true;
|
if (orientation === 0) return true;
|
||||||
break;
|
break;
|
||||||
case 'landscape':
|
case 'portrait-secondary':
|
||||||
|
if (orientation === 180) return true;
|
||||||
|
break;
|
||||||
|
case 'landscape':
|
||||||
|
if (orientation === -90 || orientation === 90) return true;
|
||||||
|
break;
|
||||||
case 'landscape-primary':
|
case 'landscape-primary':
|
||||||
if (orientation === -90) return true;
|
if (orientation === -90) return true;
|
||||||
break;
|
break;
|
||||||
case 'landscape':
|
|
||||||
case 'landscape-secondary':
|
case 'landscape-secondary':
|
||||||
if (orientation === 90) return true;
|
if (orientation === 90) return true;
|
||||||
break;
|
break;
|
||||||
case 'portrait':
|
default:
|
||||||
case 'portrait-secondary':
|
if (orientation === -90 || orientation === 90 || orientation === 0) return true;
|
||||||
if (orientation === 180) return true;
|
break;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (orientation === -90 || orientation === 90 || orientation === 0) return true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user