You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cz...@apache.org on 2013/01/09 20:10:30 UTC

svn commit: r1431012 - in /flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers: DividedGroup.as HDividerGroup.as VDividerGroup.as

Author: czadra
Date: Wed Jan  9 19:10:29 2013
New Revision: 1431012

URL: http://svn.apache.org/viewvc?rev=1431012&view=rev
Log:
FLEX-33336 patch submitted by Bogdan Dinu - HDividerGroup not resizing properly if the divider is not in the initial position

Modified:
    flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/DividedGroup.as
    flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/HDividerGroup.as
    flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/VDividerGroup.as

Modified: flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/DividedGroup.as
URL: http://svn.apache.org/viewvc/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/DividedGroup.as?rev=1431012&r1=1431011&r2=1431012&view=diff
==============================================================================
--- flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/DividedGroup.as (original)
+++ flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/DividedGroup.as Wed Jan  9 19:10:29 2013
@@ -45,9 +45,7 @@ package org.apache.flex.components.spark
 
 		protected var _cursorID : int = CursorManager.NO_CURSOR;
 		protected var _currentActiveDivider : Divider;
-		protected var _typicalDividerWidth : Number;
-		protected var _typicalDividerHeight : Number;
-
+		
 		private var _isCreatingChildren : Boolean = false;
 
 		protected var _showTooltipOnDividers : Boolean = false;
@@ -85,14 +83,6 @@ package org.apache.flex.components.spark
 			result.addEventListener(MouseEvent.MOUSE_OVER , onDividerMouseOver);
 			result.addEventListener(MouseEvent.MOUSE_OUT , onDividerMouseOut);
 			result.addEventListener(MouseEvent.MOUSE_DOWN , onDividerMouseDown);
-			if (isNaN(_typicalDividerWidth))
-			{
-				_typicalDividerWidth = result.width;
-			}
-			if(isNaN(_typicalDividerHeight))
-			{
-				_typicalDividerHeight = result.height;
-			}
 			result.upOrRightNeighbour = firstChild;
 			result.downOrLeftNeighbour = secondChild;
 			dividers.push(result);
@@ -155,6 +145,12 @@ package org.apache.flex.components.spark
 			_currentActiveDivider = null;
 			systemManager.getSandboxRoot().removeEventListener(MouseEvent.MOUSE_MOVE, onDividerMouseMove, true);
 			systemManager.deployMouseShields(false);
+			makePercentsOutOfWidths();
+		}
+		
+		protected function makePercentsOutOfWidths():void
+		{
+			
 		}
 
 		protected function onDividerMouseMove(e:MouseEvent):void
@@ -219,4 +215,4 @@ package org.apache.flex.components.spark
 		}
 
 	}
-}
+}
\ No newline at end of file

Modified: flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/HDividerGroup.as
URL: http://svn.apache.org/viewvc/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/HDividerGroup.as?rev=1431012&r1=1431011&r2=1431012&view=diff
==============================================================================
--- flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/HDividerGroup.as (original)
+++ flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/HDividerGroup.as Wed Jan  9 19:10:29 2013
@@ -147,6 +147,32 @@ package org.apache.flex.components.spark
 		 *  @playerversion Flash 10.1
 		 *  @playerversion AIR 2.5
 		 *  @productversion Flex 4.5
+		 * 
+		 * After we finished dragging the divider, we need to recalculate percents
+		 * because otherwise resizing the parent of this group won't rezise elements in layout
+		 */
+		override protected function makePercentsOutOfWidths():void
+		{
+			if (!_children || _children.length <= 1)
+			{
+				return;
+			}
+			//we're sure that the element #1 is divider, since if we don't have at least two elements and a divider we're throwing an error
+			//@See createChildren method of the DividedGroup
+			var _typicalDividerWidth : int = horizontalLayout.getElementBounds(1).width;
+			for (var j : int = 0 ; j < _children.length ; j++)
+			{
+				if (isNaN((_children[j] as IVisualElement).percentWidth))
+				{
+					(_children[j] as IVisualElement).percentWidth = (_children[j] as IVisualElement).width / (unscaledWidth - _typicalDividerWidth - horizontalLayout.gap) * 100 ;
+				}
+			}			
+		}
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
 		 */
 		//----------------------------------
 		//  @private - internal
@@ -449,4 +475,4 @@ package org.apache.flex.components.spark
 			dispatchEvent(event);
 		}
 	}
-}
+}
\ No newline at end of file

Modified: flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/VDividerGroup.as
URL: http://svn.apache.org/viewvc/flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/VDividerGroup.as?rev=1431012&r1=1431011&r2=1431012&view=diff
==============================================================================
--- flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/VDividerGroup.as (original)
+++ flex/sdk/branches/develop/frameworks/projects/experimental/src/org/apache/flex/components/sparkDividers/VDividerGroup.as Wed Jan  9 19:10:29 2013
@@ -143,11 +143,37 @@ package org.apache.flex.components.spark
 			}
 		}
 		/**
-		 *  @langversion 3.0
+		 * @langversion 3.0
 		 *  @playerversion Flash 10.1
 		 *  @playerversion AIR 2.5
 		 *  @productversion Flex 4.5
+		 * 
+		 * After we finished dragging the divider, we need to recalculate percents
+		 * because otherwise resizing the parent of this group won't rezise elements in layout
 		 */
+		override protected function makePercentsOutOfWidths():void
+		{
+			if (!_children || _children.length <= 1)
+			{
+				return;
+			}
+			//we're sure that the element #1 is divider, since if we don't have at least two elements and a divider we're throwing an error
+			//@See createChildren method of the DividedGroup
+			var _typicalDividerHeight : int = verticalLayout.getElementBounds(1).height;
+			for (var j : int = 0 ; j < _children.length ; j++)
+			{
+				if (isNaN((_children[j] as IVisualElement).percentHeight))
+				{
+					(_children[j] as IVisualElement).percentHeight = (_children[j] as IVisualElement).height / (unscaledHeight - _typicalDividerHeight - verticalLayout.gap) * 100 ;
+				}
+			}			
+		}
+		/**
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.1
+		 *  @playerversion AIR 2.5
+		 *  @productversion Flex 4.5
+		 */		
 		//----------------------------------
 		//  @private - internal
 		//----------------------------------
@@ -450,4 +476,4 @@ package org.apache.flex.components.spark
 			dispatchEvent(event);
 		}
 	}
-}
+}
\ No newline at end of file