flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Moore (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLEX-34653) Overriding RuntimeDPIProvider causes incorrect application scalling
Date Thu, 04 Dec 2014 09:21:12 GMT

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

Jason Moore commented on FLEX-34653:

I believe it is a bug.

My understanding is this...

You set the applicationDPI which identifies the expected DPI for the application say 160.
The runtimeDPI is then set to the device DPI.. normally this is automatic. Say 240.

The scale value is then calculated between the application intended DPI and the runtimeDPI
.. in the figues above this gives a scale of 1.5.. which is then applied to the application

I believe you override the runtimeDPIProvider when the reported DPI is incorrect. There have
been issues with mobile devices.. but the main one ( for me especially ) is desktop - desktop
OS do not report their screens DPI correctly.

>From the docs...

The RuntimeDPIProvider class provides the default mapping of similar device DPI values into
predefined DPI classes. An Application may have its runtimeDPIProvider property set to a subclass
of RuntimeDPIProvider to override Flex's default mappings. Overriding Flex's default mappings
will cause changes in the Application's automatic scaling behavior.

Overriding Flex's default mappings is usually only necessary for devices that incorrectly
report their screenDPI and for devices that may scale better in a different DPI class.

I have a desktop application I'm tring to override the runtimeDPI for.. but its messing up
the scaling.

Or have I got it completely wrong...?

J :)

> Overriding RuntimeDPIProvider causes incorrect application scalling
> -------------------------------------------------------------------
>                 Key: FLEX-34653
>                 URL: https://issues.apache.org/jira/browse/FLEX-34653
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Layout - General, Skinning
>    Affects Versions: Apache Flex 4.13.0
>         Environment: Windows ( Possible Mac - Not checked ).
>            Reporter: Jason Moore
>              Labels: DPI, Scaling, automatic
> The issue occurs when using automatic scaling and setting the application DPI and overriding
the runtimeDPIProvider to set the runtimeDPI where it is incorrectly returned from the OS
( On desktop devices for instance ).
> If the two values match ie 1:1 scaling, there is no issue. But if they differ then the
application content is scalled correctly , but the stage size is also scaled, incorrect. This
leads to the application being clipped when scaling up and excess space when scaling down..
See code excepts to recreate...
> {code:title=ScaleIssue.mxml|borderStyle=solid}
> <?xml version="1.0" encoding="utf-8"?>
> <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
> 					   xmlns:s="library://ns.adobe.com/flex/spark" 
> 					   xmlns:mx="library://ns.adobe.com/flex/mx"
> 					   applicationDPI="160"
> 					   runtimeDPIProvider="myRuntimeDPIProvider">
> 		<s:Label id="LeftMarker" left="0" verticalCenter="0" text="&lt;--- LEFT" fontSize="24"/>
> 		<s:Label id="MiddleMarker" horizontalCenter="0" verticalCenter="0" text="&gt;
&gt; &gt; MIDDLE &lt; &lt; &lt;" fontSize="24"/>
> 		<s:Label id="RightMarker" right="0" verticalCenter="0" text="RIGHT ---&gt;"
> </s:WindowedApplication>
> {code}
> {code:title=myRuntimeDPIProvider.as|borderStyle=solid}
> package 
> {
> 	import mx.core.DPIClassification;
> 	import mx.core.RuntimeDPIProvider;
> 	public class myRuntimeDPIProvider extends RuntimeDPIProvider
> 	{
> 		/**
> 		 * Overrride getter function so we can set the dpi manually when running on desktop
> 		 * This would normally be a bit more sophisticated... 
> 		 * 
> 		 * @return 
> 		 * 
> 		 */		
> 		override public function get runtimeDPI():Number
> 		{			
> 			return DPIClassification.DPI_240;
> 		}
> 	}
> }
> {code}
> You should see the text labels pointing to the left and right screen edges.. but instead
the right hand label is off screen.
> Hope that makes sense.
> J :)

This message was sent by Atlassian JIRA

View raw message