flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcl...@apache.org
Subject [2/2] git commit: [flex-sdk] [refs/heads/develop] - FLEX-369 take gadding into account and always display at least one line of text even if it overlaps the buttons
Date Sun, 25 May 2014 23:27:18 GMT
FLEX-369 take gadding into account and always display at least one line of text even if it
overlaps the buttons


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/2ccb9007
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/2ccb9007
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/2ccb9007

Branch: refs/heads/develop
Commit: 2ccb90077f44e8deee36b2af509e3a7f014b1cd6
Parents: ddc3c5e
Author: Justin Mclean <jmclean@apache.org>
Authored: Fri May 23 16:52:40 2014 -0700
Committer: Justin Mclean <jmclean@apache.org>
Committed: Fri May 23 16:52:40 2014 -0700

----------------------------------------------------------------------
 .../mx/src/mx/controls/alertClasses/AlertForm.as         | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/2ccb9007/frameworks/projects/mx/src/mx/controls/alertClasses/AlertForm.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mx/src/mx/controls/alertClasses/AlertForm.as b/frameworks/projects/mx/src/mx/controls/alertClasses/AlertForm.as
index 0a9afd2..471f544 100644
--- a/frameworks/projects/mx/src/mx/controls/alertClasses/AlertForm.as
+++ b/frameworks/projects/mx/src/mx/controls/alertClasses/AlertForm.as
@@ -380,11 +380,20 @@ public class AlertForm extends UIComponent implements IFontContextComponent
 		}
 
 		var newHeight:Number = textField.getExplicitOrMeasuredHeight();
-		var maxHeight:Number = unscaledHeight - buttons[0].height;
+		var paddingTop:Number = textField.getStyle("paddingTop");
+		var paddingBottom:Number = textField.getStyle("paddingBottom");
+		var maxHeight:Number = unscaledHeight - buttons[0].height
+			- paddingTop - paddingBottom;
 		
 		if (newHeight > maxHeight)
 			newHeight = maxHeight;
 		
+		// try and make at least one line of text show even if it overlapps buttons
+		// this may occur if the height of alert box is set to be too small
+		var lineMetrics:TextLineMetrics = textField.getUITextFormat().measureText(textField.text);
+		if (newHeight < lineMetrics.height)
+			newHeight = lineMetrics.height;
+		
 		textField.move(newX, Math.round((newY - newHeight) / 2));
 		textField.setActualSize(textWidth+5, newHeight);
 	}


Mime
View raw message