cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-13193) Setting orientation to landscape might turn UI upside down if already in landscape
Date Sun, 01 Jul 2018 12:38:00 GMT

    [ https://issues.apache.org/jira/browse/CB-13193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16529075#comment-16529075
] 

ASF GitHub Bot commented on CB-13193:
-------------------------------------

jcesarmobile closed pull request #25: CB-13193: (ios) Fixed Lock iOS Landscape Orientation
turn up-sidedown
URL: https://github.com/apache/cordova-plugin-screen-orientation/pull/25
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/ios/CDVOrientation.m b/src/ios/CDVOrientation.m
index 0152680..ff718f8 100644
--- a/src/ios/CDVOrientation.m
+++ b/src/ios/CDVOrientation.m
@@ -42,10 +42,10 @@ -(void)screenOrientation:(CDVInvokedUrlCommand *)command
         [result addObject:[NSNumber numberWithInt:UIInterfaceOrientationPortraitUpsideDown]];
     }
     if(orientationMask & 4) {
-        [result addObject:[NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft]];
+        [result addObject:[NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight]];
     }
     if(orientationMask & 8) {
-        [result addObject:[NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight]];
+        [result addObject:[NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft]];
     }
     
     SEL selector = NSSelectorFromString(@"setSupportedOrientations:");
@@ -61,11 +61,12 @@ -(void)screenOrientation:(CDVInvokedUrlCommand *)command
                 if (!_isLocked) {
                     _lastOrientation = [UIApplication sharedApplication].statusBarOrientation;
                 }
-                if(orientationMask == 8 || orientationMask == 12) {
-                    value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
-                } else if (orientationMask == 4){
+                UIInterfaceOrientation deviceOrientation = [UIApplication sharedApplication].statusBarOrientation;
+                if(orientationMask == 8  || (orientationMask == 12  && !UIInterfaceOrientationIsLandscape(deviceOrientation)))
{
                     value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
-                } else if (orientationMask == 1 || orientationMask == 3) {
+                } else if (orientationMask == 4){
+                    value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
+                } else if (orientationMask == 1 || (orientationMask == 3 && !UIInterfaceOrientationIsPortrait(deviceOrientation)))
{
                     value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
                 } else if (orientationMask == 2) {
                     value = [NSNumber numberWithInt:UIInterfaceOrientationPortraitUpsideDown];


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Setting orientation to landscape might turn UI upside down if already in landscape
> ----------------------------------------------------------------------------------
>
>                 Key: CB-13193
>                 URL: https://issues.apache.org/jira/browse/CB-13193
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-screen-orientation
>            Reporter: Jonathan Herdt
>            Assignee: Vishal Mishra
>            Priority: Major
>
> Steps to reproduce:
> # Set up an app to lock its orientation to 'landscape' at startup via `screen.orientation.lock('landscape')`
> # Set device to landscape-left (home button on left side)
> # Start app
> # Observe UI turning upside down
> Desired behavior: Rotation is locked but UI does not turn upside down



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message