flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcl...@apache.org
Subject [1/5] git commit: [flex-sdk] [refs/heads/develop] - Replaced removeRangeFromSelection with sane code (thanks to Erik)
Date Thu, 09 May 2013 05:56:58 GMT
Updated Branches:
  refs/heads/develop b0ddb4ec2 -> 02aa4310b


Replaced removeRangeFromSelection with sane code (thanks to Erik)


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

Branch: refs/heads/develop
Commit: fe78d41ad41e972e71474ec7ca15707e263d0823
Parents: b0ddb4e
Author: Justin Mclean <jmclean@apache.org>
Authored: Thu May 9 10:50:35 2013 +1000
Committer: Justin Mclean <jmclean@apache.org>
Committed: Thu May 9 10:50:35 2013 +1000

----------------------------------------------------------------------
 .../projects/mx/src/mx/controls/CalendarLayout.as  |  111 +++++++--------
 1 files changed, 52 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/fe78d41a/frameworks/projects/mx/src/mx/controls/CalendarLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mx/src/mx/controls/CalendarLayout.as b/frameworks/projects/mx/src/mx/controls/CalendarLayout.as
index 745f43e..138b4c7 100644
--- a/frameworks/projects/mx/src/mx/controls/CalendarLayout.as
+++ b/frameworks/projects/mx/src/mx/controls/CalendarLayout.as
@@ -2001,66 +2001,59 @@ public class CalendarLayout extends UIComponent
      *  from the selected dates.
      */
     mx_internal function removeRangeFromSelection(startDate:Date, endDate:Date):void
-    {
-        for (var n:int = 0; n < selectedRangeCount; n++)
-        {
-            var s1:int;
-
-            if (!startDate || startDate <= _selectedRanges[n].rangeStart)
-                s1 = 1;
-            else if (startDate <= _selectedRanges[n].rangeEnd)
-                s1 = 2;
-            else if (startDate > _selectedRanges[n].rangeEnd)
-                s1 = 3;
-
-            if (endDate < _selectedRanges[n].rangeStart)
-                s1 *= 5;
-            else if (endDate < _selectedRanges[n].rangeEnd)
-                s1 *= 7;
-            else if (!endDate || endDate >= _selectedRanges[n].rangeEnd)
-                s1 *= 11;
-
-            switch (s1)
-            {
-                case 5:
-                case 33:
-                    break;
-
-                case 14:
-                {
-                    var temp:Date = _selectedRanges[n].rangeEnd;
-
-                    _selectedRanges[n].rangeEnd = incrementDate(startDate,-1);
-
-                    _selectedRanges[selectedRangeCount] = {};
-                    _selectedRanges[selectedRangeCount].rangeStart = incrementDate(endDate);
-                    _selectedRanges[selectedRangeCount].rangeEnd = temp;
-                    selectedRangeCount += 1;
-                    break;
-                }
-
-                case 7:
-                {
-                    _selectedRanges[n].rangeStart = incrementDate(endDate);
-                    break;
-                }
-
-                case 22:
-                {
-                    _selectedRanges[n].rangeEnd = incrementDate(startDate,-1);
-                    break;
-                }
+	{
+		var rangeEnd:Date;
+		var rangeStart:Date;
+		
+		if (endDate < startDate)
+			return;
+		
+		for (var n:int = 0; n < selectedRangeCount; n++)
+		{
+			rangeStart = _selectedRanges[n].rangeStart;
+			
+			if (endDate < rangeStart)
+				continue;
+			
+			rangeEnd = _selectedRanges[n].rangeEnd;
+			
+			if (startDate <= rangeStart)
+			{
+				if (endDate < rangeEnd)
+				{
+					_selectedRanges[n].rangeStart = incrementDate(endDate);
+				}
+				else
+				{
+					_selectedRanges[n] = _selectedRanges[selectedRangeCount - 1];
+					_selectedRanges[selectedRangeCount - 1] = null;
+					
+					selectedRangeCount -= 1;
+				}
+			}
+			else if (startDate <= rangeEnd)
+			{
+				if (endDate < rangeEnd)
+				{
+					var temp:Date = _selectedRanges[n].rangeEnd;
+					
+					_selectedRanges[n].rangeEnd = incrementDate(startDate, -1);
+					
+					_selectedRanges[selectedRangeCount] = {};
+					_selectedRanges[selectedRangeCount].rangeStart =
+						incrementDate(endDate);
+					_selectedRanges[selectedRangeCount].rangeEnd = temp;
+					
+					selectedRangeCount += 1;
+				}
+				else
+				{
+					_selectedRanges[n].rangeEnd = incrementDate(startDate, -1);
+				}
+			}
+		}
+	}
 
-                case 11:
-                {
-                    _selectedRanges[n] = _selectedRanges[selectedRangeCount-1];
-                    _selectedRanges[selectedRangeCount-1] = null;
-                    selectedRangeCount -= 1;
-                    break;
-                }
-            }
-        }
-    }
 
     /**
      *  @private


Mime
View raw message