This is an automated email from the ASF dual-hosted git repository.

jianhan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git


The following commit(s) were added to refs/heads/master by this push:
     new 3939692  Initialize weex using portrait screen size. (#2898)
3939692 is described below

commit 393969296c808346333dec90af6114e9d9d9e84e
Author: wqyfavor <[email protected]>
AuthorDate: Mon Sep 16 11:26:08 2019 +0800

    Initialize weex using portrait screen size. (#2898)
---
 ios/sdk/WeexSDK/Sources/Bridge/WXCoreBridge.mm | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/ios/sdk/WeexSDK/Sources/Bridge/WXCoreBridge.mm 
b/ios/sdk/WeexSDK/Sources/Bridge/WXCoreBridge.mm
index 44cd38b..fb3a03c 100644
--- a/ios/sdk/WeexSDK/Sources/Bridge/WXCoreBridge.mm
+++ b/ios/sdk/WeexSDK/Sources/Bridge/WXCoreBridge.mm
@@ -1538,11 +1538,14 @@ static WeexCore::ScriptBridge* jsBridge = nullptr;
         env->AddOption("scale", "1");
         env->AddOption("pixel_scale", std::to_string([[UIScreen mainScreen] 
scale]));
         
+        // Here we initialize weex device width and height using portrait by 
default.
         CGSize screenSize = [UIScreen mainScreen].bounds.size;
-        env->SetDeviceWidth(std::to_string(screenSize.width));
-        env->SetDeviceHeight(std::to_string(screenSize.height));
-        env->AddOption("screen_width_pixels", 
std::to_string(screenSize.width));
-        env->AddOption("screen_height_pixels", 
std::to_string(screenSize.height));
+        CGFloat w = MIN(screenSize.width, screenSize.height);
+        CGFloat h = MAX(screenSize.width, screenSize.height);
+        env->SetDeviceWidth(std::to_string(w));
+        env->SetDeviceHeight(std::to_string(h));
+        env->AddOption("screen_width_pixels", std::to_string(w));
+        env->AddOption("screen_height_pixels", std::to_string(h));
         
         weex::base::LogImplement::getLog()->setLogImplement(new 
WeexCore::LogBridgeIOS());
         
@@ -1552,8 +1555,6 @@ static WeexCore::ScriptBridge* jsBridge = nullptr;
         weex::base::LogImplement::getLog()->setDebugMode(false);
 #endif
         
-        
-        
         platformBridge = new WeexCore::PlatformBridge();
         platformBridge->set_platform_side(new WeexCore::IOSSide());
         platformBridge->set_core_side(new WeexCore::CoreSideInPlatform());

Reply via email to