You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2013/10/11 08:19:21 UTC

[06/10] git commit: [flex-sdk] [refs/heads/develop] - ScrollBar should defer some of its calculations when styles change to a lifecycle method so things that affect measurement have a chance to be measured.

ScrollBar should defer some of its calculations when styles change to a lifecycle method so things that affect measurement have a chance to be measured.


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

Branch: refs/heads/develop
Commit: 9c5f91e5f25459c34b420c8596bb80adc5441498
Parents: 05833f8
Author: Alex Harui <ah...@apache.org>
Authored: Thu Sep 5 09:52:36 2013 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Oct 10 23:18:37 2013 -0700

----------------------------------------------------------------------
 .../spark/src/spark/components/VScrollBar.as    | 25 +++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/9c5f91e5/frameworks/projects/spark/src/spark/components/VScrollBar.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/components/VScrollBar.as b/frameworks/projects/spark/src/spark/components/VScrollBar.as
index 144a420..a8afadb 100644
--- a/frameworks/projects/spark/src/spark/components/VScrollBar.as
+++ b/frameworks/projects/spark/src/spark/components/VScrollBar.as
@@ -158,6 +158,8 @@ public class VScrollBar extends ScrollBarBase
     //
     //--------------------------------------------------------------------------
 
+	private var maxAndPageSizeInvalid:Boolean = false;
+	
     private function updateMaximumAndPageSize():void
     {
         var vsp:Number = viewport.verticalScrollPosition;
@@ -523,11 +525,28 @@ public class VScrollBar extends ScrollBarBase
         if (allStyles || styleName == "interactionMode")
         {
             if (viewport)
-                updateMaximumAndPageSize();
+			{
+				// Some of the information needed
+				// is calculated in measure() on a child
+				maxAndPageSizeInvalid = true;
+				invalidateSize();
+			}
         }
     }
-    
-    
+
+	/**
+	 *  @private 
+	 */
+	override protected function measure():void
+	{
+		super.measure();
+		if (maxAndPageSizeInvalid)
+		{
+			maxAndPageSizeInvalid = false;
+			updateMaximumAndPageSize();
+		}
+	}
+	
     /**
      *  @private
      *  Scroll vertically by event.delta "steps".  This listener is added to both the scrollbar