mirror of
https://github.com/apache/cordova-plugin-screen-orientation.git
synced 2025-02-24 00:52:50 +08:00
Removed direct reference to screen in addScreenOrientationApi function
This commit is contained in:
parent
1195b40612
commit
c8b89002f9
@ -45,24 +45,22 @@ screenOrientation.setOrientation = function(orientation) {
|
|||||||
console.log('setOrientation not supported on device');
|
console.log('setOrientation not supported on device');
|
||||||
};
|
};
|
||||||
|
|
||||||
function addScreenOrientationApi(obj) {
|
function addScreenOrientationApi(screenObject) {
|
||||||
if (obj.unlockOrientation || obj.lockOrientation) {
|
if (screenObject.unlockOrientation || screenObject.lockOrientation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.lockOrientation = function(orientation) {
|
screenObject.lockOrientation = function(orientation) {
|
||||||
if (Orientations.indexOf(orientation) == -1) {
|
if (Orientations.indexOf(orientation) == -1) {
|
||||||
console.log('INVALID ORIENTATION', orientation);
|
console.log('INVALID ORIENTATION', orientation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
screenOrientation.currOrientation = orientation;
|
screenOrientation.currOrientation = screenObject.orientation = orientation;
|
||||||
screen.orientation = screenOrientation.currOrientation;
|
|
||||||
screenOrientation.setOrientation(orientation);
|
screenOrientation.setOrientation(orientation);
|
||||||
};
|
};
|
||||||
|
|
||||||
obj.unlockOrientation = function() {
|
screenObject.unlockOrientation = function() {
|
||||||
screenOrientation.currOrientation = 'unlocked';
|
screenOrientation.currOrientation = screenObject.orientation = 'unlocked';
|
||||||
screen.orientation = screenOrientation.currOrientation;
|
|
||||||
screenOrientation.setOrientation('unlocked');
|
screenOrientation.setOrientation('unlocked');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user