Author: alanmc
Date: 2008-02-05 15:49:16 -0500 (Tue, 05 Feb 2008)
New Revision: 94946

Modified:
   trunk/lunareclipse/Model/Draw/CircleDraw.cs
   trunk/lunareclipse/Model/Draw/SquareDraw.cs
Log:
Updated circle/square to work with non-negative co-ords

Modified: trunk/lunareclipse/Model/Draw/CircleDraw.cs
===================================================================
--- trunk/lunareclipse/Model/Draw/CircleDraw.cs 2008-02-05 20:35:35 UTC (rev 
94945)
+++ trunk/lunareclipse/Model/Draw/CircleDraw.cs 2008-02-05 20:49:16 UTC (rev 
94946)
@@ -21,24 +21,14 @@
         
         internal override void MouseMove (MouseEventArgs e)
         {
-            Point end = e.GetPosition(Panel);
-            double width = end.X - 
(double)Element.GetValue(Canvas.LeftProperty);
-            double height = end.Y - 
(double)Element.GetValue(Canvas.TopProperty);
-
-            if(Math.Abs(width) > Math.Abs(height))
-            {
-                Width = width;
-                if(Math.Sign(width) != Math.Sign(height))
-                    width = -width;
-                Height = width;
-            }
-            else
-            {
-                Height = height;
-                if(Math.Sign(width) != Math.Sign(height))
-                    height = -height;
-                Width = height;
-            }
+                       base.MouseMove(e);
+            double max = Math.Max(Math.Abs(actualWidth), 
Math.Abs(actualHeight));
+                       
+                       Width = max;
+                       Height = max;
+                       
+                       Left = (actualWidth < 0) ? actualLeft - max : 
actualLeft;
+                       Top = (actualHeight < 0) ? actualTop - max : actualTop;
         }
     }
 }

Modified: trunk/lunareclipse/Model/Draw/SquareDraw.cs
===================================================================
--- trunk/lunareclipse/Model/Draw/SquareDraw.cs 2008-02-05 20:35:35 UTC (rev 
94945)
+++ trunk/lunareclipse/Model/Draw/SquareDraw.cs 2008-02-05 20:49:16 UTC (rev 
94946)
@@ -24,24 +24,14 @@
                
         internal override void MouseMove (MouseEventArgs e)
         {
-            Point end = e.GetPosition(Panel);
-            double width = end.X - 
(double)Element.GetValue(Canvas.LeftProperty);
-            double height = end.Y - 
(double)Element.GetValue(Canvas.TopProperty);
-            
-            if(Math.Abs(width) > Math.Abs(height))
-            {
-                Width = width;
-                if(Math.Sign(width) != Math.Sign(height))
-                    width = -width;
-                Height = width;
-            }
-            else
-            {
-                Height = height;
-                if(Math.Sign(width) != Math.Sign(height))
-                    height = -height;
-                Width = height;
-            }
+                       base.MouseMove(e);
+            double max = Math.Max(Math.Abs(actualWidth), 
Math.Abs(actualHeight));
+                       
+                       Width = max;
+                       Height = max;
+                       
+                       Left = (actualWidth < 0) ? actualLeft - max : 
actualLeft;
+                       Top = (actualHeight < 0) ? actualTop - max : actualTop;
         }
     }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to