flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jorn Nolles (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (FLEX-34556) Starting an app in portrait on an iPad results in wrong DPI
Date Tue, 07 Oct 2014 07:35:33 GMT

     [ https://issues.apache.org/jira/browse/FLEX-34556?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jorn Nolles updated FLEX-34556:
-------------------------------
    Description: 
*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...

  was:
*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...


> 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)

Mime
View raw message