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

Jorn Nolles commented on FLEX-34556:
------------------------------------

[~bigosmallm], the improved code (solution) is given in the issue description. 
Could you (or anyone else from Apache Flex) take it from here?

> Starting an app in portrait on an iPad results in wrong DPI
> -----------------------------------------------------------
>
>                 Key: FLEX-34556
>                 URL: https://issues.apache.org/jira/browse/FLEX-34556
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Mobile: MobileApplication, Spark: Application
>    Affects Versions: Apache Flex 4.13.0
>         Environment: iOS 5.1, iOS 7, iOS 8
>            Reporter: Jorn Nolles
>
> *Reproduction*
> # Create an mobile project.
> # Set the 'applicationDPI' to '160'
> # Add some components
> # Now create a build for iOS
> Start the app on the iPad while holding it in 'landscape' mode:
> Result: all components are of the correct size
> Start the app on the iPad while holding it in 'portrait' mode:
> Result: the components are too small.
> *Problem*
> The mx.core.RuntimeDPIProvider has a bug while attempting to determine teh 
> device width/hight (in function runtimeDPI).
> *Solution*
> Don't use 'stage.fullScreenWidth' but use Capabilities.screenResolutionX.
> {code}
> public function get runtimeDPI():Number
> {
>       if (Platform.isIOS) // as isIPad returns false in the simulator
>       {
>               // The original code uses the stage width/height, which is not 
> always set (if the app is started on an iPad in portrait)
>               var scX:Number = Capabilities.screenResolutionX;
>               var scY:Number = Capabilities.screenResolutionY;
>                               
>               // Use the stage width/height only when debugging, because 
> Capabilities reports the computer resolution
>               if (Capabilities.isDebugger)
>               {
>                       var root:DisplayObject = SystemManager.getSWFRoot(this);
>                       if (root && root.stage)
>                       {
>                               scX = root.stage.fullScreenWidth;
>                               scY = root.stage.fullScreenHeight;
>                       }
>               }
>                               
>               /*  as of Dec 2013,  iPad (resp. iPad retina) are the only iOS 
> devices to have 1024 (resp. 2048) screen width or height
>               cf 
> http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density#Apple
>               * */
>               if (scX == IPAD_MAX_EXTENT || scY == IPAD_MAX_EXTENT)
>                       return DPIClassification.DPI_160;
>               else if ((scX == IPAD_RETINA_MAX_EXTENT || scY == 
> IPAD_RETINA_MAX_EXTENT))
>                       return DPIClassification.DPI_320;
>       }
>                       
>       return classifyDPI(Capabilities.screenDPI);
> }
> {code}
> *Workaround*
> Create an override on the runtimeDPI() getter...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to