mirror of
https://github.com/apache/cordova-plugin-screen-orientation.git
synced 2025-02-24 00:52:50 +08:00
Added Windows 8.1 Support
Windows 8.1 has javascript calls, were not be complicated to add.
This commit is contained in:
parent
9244abcbbe
commit
7a11a3dd7e
@ -96,6 +96,9 @@ Windows phone does not support specification or primary and secondary orientatio
|
||||
|
||||
# Changelog
|
||||
|
||||
## 1.3.7
|
||||
* Added Windows 8.1 Support
|
||||
|
||||
## 1.3.5-6
|
||||
* Plugin added to npm
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "cordova-plugin-screen-orientation",
|
||||
"version": "1.3.6",
|
||||
"description": "Adds Screen Orientation API lock and unlock functions to the global screen object in android, iOS, WP8 and BB10.",
|
||||
"version": "1.3.7",
|
||||
"description": "Adds Screen Orientation API lock and unlock functions to the global screen object in android, iOS, WP8, W8.1, and BB10.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/gbenvenuti/cordova-plugin-screen-orientation.git"
|
||||
|
@ -5,7 +5,7 @@
|
||||
version="1.3.6">
|
||||
|
||||
<name>Screen Orientation</name>
|
||||
<description>Adds Screen Orientation API lock and unlock functions to the global screen object in android, iOS, WP8 and BB10.</description>
|
||||
<description>Adds Screen Orientation API lock and unlock functions to the global screen object in android, iOS, WP8, W8.1, and BB10.</description>
|
||||
<license>MIT</license>
|
||||
|
||||
<engines>
|
||||
@ -64,4 +64,10 @@
|
||||
<source-file src="src/wp/YoikScreenOrientation.cs" />
|
||||
</platform>
|
||||
|
||||
<platform name="windows">
|
||||
<js-module src="www/screenOrientation.windows.js" name="screenorientation.windows">
|
||||
<merges target="cordova.plugins.screenorientation" />
|
||||
</js-module>
|
||||
</platform>
|
||||
|
||||
</plugin>
|
||||
|
33
www/screenorientation.windows.js
Normal file
33
www/screenorientation.windows.js
Normal file
@ -0,0 +1,33 @@
|
||||
var screenOrientation = {};
|
||||
|
||||
screenOrientation.lockOrientation = function (orientation) {
|
||||
var orientationNumber;
|
||||
switch (orientation) {
|
||||
case 'landscape':
|
||||
orientationNumber = 5;
|
||||
break;
|
||||
case 'portrait':
|
||||
orientationNumber = 10;
|
||||
break;
|
||||
case 'landscape-primary':
|
||||
orientationNumber = 1;
|
||||
break;
|
||||
case 'landscape-secondary':
|
||||
orientationNumber = 4;
|
||||
break;
|
||||
case 'portrait-primary':
|
||||
orientationNumber = 2;
|
||||
break;
|
||||
case 'portrait-secondary':
|
||||
orientationNumber = 8;
|
||||
break;
|
||||
case 'unlocked':
|
||||
orientationNumber = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Windows.Graphics.Display.DisplayInformation.autoRotationPreferences = orientationNumber;
|
||||
};
|
||||
|
||||
module.exports = screenOrientation;
|
Loading…
Reference in New Issue
Block a user