Jorn Nolles created FLEX-34556:
----------------------------------
Summary: 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
{
var isIOS:Boolean = Platform.isIOS;
var screenDPI:Number = Capabilities.screenDPI;
if (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;
/* 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_RETINA_MAX_EXTENT || scY ==
IPAD_RETINA_MAX_EXTENT))
return DPIClassification.DPI_320;
else if (scX == IPAD_MAX_EXTENT || scY == IPAD_MAX_EXTENT)
return DPIClassification.DPI_160;
}
return classifyDPI(screenDPI);
}
{code}
*Workaround*
Create an override on the runtimeDPI() getter...
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)