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) Setting applicationDPI (autoscaling) on desktop works incorrectly.
Date Mon, 08 Dec 2014 10:24:12 GMT

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

Jason Moore commented on FLEX-34653:
------------------------------------

Alternative to the work around supplied by Lee still using the applicationdDPI and runtimeDPI
( with or without a custom runtimeDPI provider ... ).

{code}
			// Changes the initial size of the application so it appears physically the corect size
according to the device DPI.		
			private function applicationCompleteHandler():void
			{
				this.width /= this.applicationDPI / this.runtimeDPI;
				this.height /= this.applicationDPI / this.runtimeDPI;
			}
			
			// Sets the application content width and hieght to the application's system managers calculated
screen size.
			protected function resizeHandler(event:ResizeEvent):void
			{
				if (this.systemManager)
					if (this.systemManager.screen)
					{
						this.contentGroup.width = this.systemManager.screen.width;
						this.contentGroup.height = this.systemManager.screen.height;		
					}				
			}
{code}

Changes the application width and height to make the application the correct size, lets the
internal scaling do its thing but uses the resulting application system managers calculated
screen size and applies it to the application content group to correct its dimensions.

Thanks to Lee for the support.

Jason :)



> Setting applicationDPI (autoscaling) on desktop works incorrectly.
> ------------------------------------------------------------------
>
>                 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
>         Attachments: Main.mxml, screenshot.png, screenshot2.png
>
>
> 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;"
fontSize="24"/>
> 							 
> </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
device
> 		 * 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
(v6.3.4#6332)

Mime
View raw message