flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcl...@apache.org
Subject [2/4] git commit: [flex-sdk] [refs/heads/develop] - FLEX-26948 FLEX-14269 Fix RTE in code when thumbs is null or no sliders.
Date Fri, 24 May 2013 07:31:56 GMT
FLEX-26948 FLEX-14269 Fix RTE in code when thumbs is null or no sliders.


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

Branch: refs/heads/develop
Commit: 40489af7596e8bcfbb662c700ba868f88245efad
Parents: ed830c8
Author: Justin Mclean <jmclean@apache.org>
Authored: Fri May 24 16:37:11 2013 +1000
Committer: Justin Mclean <jmclean@apache.org>
Committed: Fri May 24 16:37:11 2013 +1000

----------------------------------------------------------------------
 .../mx/src/mx/controls/sliderClasses/Slider.as     |   28 ++++++++------
 1 files changed, 16 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/40489af7/frameworks/projects/mx/src/mx/controls/sliderClasses/Slider.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mx/src/mx/controls/sliderClasses/Slider.as b/frameworks/projects/mx/src/mx/controls/sliderClasses/Slider.as
index 9b0394a..5d4dd6e 100644
--- a/frameworks/projects/mx/src/mx/controls/sliderClasses/Slider.as
+++ b/frameworks/projects/mx/src/mx/controls/sliderClasses/Slider.as
@@ -1826,14 +1826,20 @@ public class Slider extends UIComponent
 
         var isHorizontal:Boolean = (_direction == SliderDirection.HORIZONTAL);
         var numLabels:int = labelObjects ? labelObjects.numChildren : 0;
-        var numThumbs:int = thumbs ? thumbs.numChildren : 0;
         var trackMargin:Number = getStyle("trackMargin");
-        var widestThumb:Number = 6;
-        var firstThumb:SliderThumb = SliderThumb(thumbs.getChildAt(0));
-        if (thumbs && firstThumb)
-            widestThumb = firstThumb.getExplicitOrMeasuredWidth();
-
-        var trackLeftOffset:Number = widestThumb / 2; // Enough space for the thumb to rest
at the edges
+		var firstThumbWidth:Number = 6;
+		var firstThumbHeight:Number = 0;
+        var firstThumb:SliderThumb;
+		
+		if (thumbs && thumbs.numChildren > 0)
+			firstThumb = SliderThumb(thumbs.getChildAt(0));
+		
+        if (thumbs && firstThumb) {
+			firstThumbWidth = firstThumb.getExplicitOrMeasuredWidth();
+			firstThumbHeight = firstThumb.getExplicitOrMeasuredHeight();
+		}
+
+        var trackLeftOffset:Number = firstThumbWidth / 2; // Enough space for the thumb to
rest at the edges
         var trackRightOffset:Number = trackLeftOffset;
 
         var availSpace:Number;
@@ -1894,7 +1900,7 @@ public class Slider extends UIComponent
 
         // Layout the thumbs' y positions.
         var tY:Number = track.y +
-                        (track.height - firstThumb.getExplicitOrMeasuredHeight()) / 2 +
+                        (track.height - firstThumbHeight) / 2 +
                         getStyle("thumbOffset");
 
         var n:int = _thumbCount;
@@ -1914,12 +1920,10 @@ public class Slider extends UIComponent
             tLength = getStyle("tickLength");
         g.clear();      
         g.beginFill(0,0);
-        var fullThumbHeight:Number = firstThumb.getExplicitOrMeasuredHeight();
-        var halfThumbHeight:Number = (!fullThumbHeight) ? 0 : (fullThumbHeight / 2);
         g.drawRect(track.x, 
-                track.y - halfThumbHeight - tLength, 
+                track.y - firstThumbHeight/2 - tLength, 
                 track.width, 
-                track.height + fullThumbHeight + tLength);
+                track.height + firstThumbHeight + tLength);
         g.endFill();
 
         if (_direction != SliderDirection.HORIZONTAL)


Mime
View raw message