From 4f36055bebbdd8e43159e480de632aa32842539f Mon Sep 17 00:00:00 2001 From: Johan Eliasson Date: Mon, 20 Jul 2015 14:37:27 +0200 Subject: [PATCH 1/3] added example on orientationchange --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 2110622..6a9a197 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,12 @@ For this plugin to follow the full API events should be fired on the screen obje iOS and BB10 do not currently support events on the _screen_ object so custom event handling will need to be added (Suggestions welcome!). +### Example usage + + window.addEventListener("orientationchange", function(){ + console.log('Orientation changed to ' + screen.orientation); + }); + ## Android Notes The __screen.orientation__ property will not update when the phone is [rotated 180 degrees](http://www.quirksmode.org/dom/events/orientationchange.html). From dda55807c74649ee13d94bb5221967f9764f7245 Mon Sep 17 00:00:00 2001 From: Johan Eliasson Date: Mon, 20 Jul 2015 14:37:52 +0200 Subject: [PATCH 2/3] correct orientation naming --- www/screenorientation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/screenorientation.js b/www/screenorientation.js index eb5df68..7c74439 100644 --- a/www/screenorientation.js +++ b/www/screenorientation.js @@ -76,13 +76,13 @@ function orientationChange() { orientation = 'portrait-primary'; break; case 90: - orientation = 'landscape-secondary'; + orientation = 'landscape-primary'; break; case 180: orientation = 'portrait-secondary'; break; case -90: - orientation = 'landscape-primary'; + orientation = 'landscape-secondary'; break; default: orientation = 'unknown'; From 1f43b5ac9c1f5035557e4f0efefacac41b92fa45 Mon Sep 17 00:00:00 2001 From: Johan Eliasson Date: Mon, 20 Jul 2015 15:04:18 +0200 Subject: [PATCH 3/3] add screen.orentation vairable update on lockOrientation() --- www/screenorientation.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/www/screenorientation.js b/www/screenorientation.js index 7c74439..64c682b 100644 --- a/www/screenorientation.js +++ b/www/screenorientation.js @@ -56,11 +56,13 @@ function addScreenOrientationApi(obj) { return; } screenOrientation.currOrientation = orientation; + screen.orientation = screenOrientation.currOrientation; screenOrientation.setOrientation(orientation); }; obj.unlockOrientation = function() { screenOrientation.currOrientation = 'unlocked'; + screen.orientation = screenOrientation.currOrientation; screenOrientation.setOrientation('unlocked'); }; }