From ad5a2134e824d63334557d01fa1d5b8413d1a35c Mon Sep 17 00:00:00 2001 From: Grant Benvenuti Date: Wed, 3 Sep 2014 11:33:52 +1000 Subject: [PATCH] Moved orientationMap block --- www/screenorientation.ios.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/www/screenorientation.ios.js b/www/screenorientation.ios.js index c155aa1..99f5e4c 100644 --- a/www/screenorientation.ios.js +++ b/www/screenorientation.ios.js @@ -1,5 +1,14 @@ var exec = require('cordova/exec'), - screenOrientation = {}; + screenOrientation = {}, + orientationMap = { + 'portrait': [0,180], + 'portrait-primary': [0], + 'portrait-secondary': [180], + 'landscape': [-90,90], + 'landscape-primary': [-90], + 'landscape-secondary': [90], + 'default': [-90,90,0] + }; screenOrientation.setOrientation = function(orientation) { exec(null, null, "YoikScreenOrientation", "screenOrientation", ['set', orientation]); @@ -10,16 +19,6 @@ module.exports = screenOrientation; // ios orientation callback/hook window.shouldRotateToOrientation = function(orientation) { var currOrientation = cordova.plugins.screenorientation.currOrientation, - orientationMap = { - 'portrait': [0,180], - 'portrait-primary': [0], - 'portrait-secondary': [180], - 'landscape': [-90,90], - 'landscape-primary': [-90], - 'landscape-secondary': [90], - 'default': [-90,90,0] - }, map = orientationMap[currOrientation] || orientationMap['default']; - return map.indexOf(orientation) >= 0; };