Author: alanmc
Date: 2008-02-05 15:16:52 -0500 (Tue, 05 Feb 2008)
New Revision: 94939
Modified:
trunk/lunareclipse/Model/Draw/DrawBase.cs
Log:
Updated drawing - negative co-ords aren't accepted anymore
Modified: trunk/lunareclipse/Model/Draw/DrawBase.cs
===================================================================
--- trunk/lunareclipse/Model/Draw/DrawBase.cs 2008-02-05 20:15:57 UTC (rev
94938)
+++ trunk/lunareclipse/Model/Draw/DrawBase.cs 2008-02-05 20:16:52 UTC (rev
94939)
@@ -29,6 +29,11 @@
private Visual element;
private Panel panel;
private Point position;
+
+ protected double actualTop;
+ protected double actualLeft;
+ protected double actualWidth;
+ protected double actualHeight;
#endregion Fields
@@ -107,8 +112,8 @@
Top = top;
Toolbox.RaiseEvent<EventArgs>(MouseUp, Panel,
EventArgs.Empty);
}
+
-
internal virtual void DrawStart(Panel panel, MouseEventArgs point)
{
Toolbox.RaiseEvent<EventArgs>(MouseDown, Panel,
EventArgs.Empty);
@@ -120,6 +125,11 @@
position = point.GetPosition(panel);
Left = position.X;
Top = position.Y;
+
+ actualTop = Top;
+ actualLeft = Left;
+ actualHeight = Height;
+ actualWidth = Width;
}
@@ -163,7 +173,6 @@
}
}
-
internal virtual void MouseMove(MouseEventArgs e)
{
Point end = e.GetPosition(panel);
@@ -171,8 +180,30 @@
double y = end.Y - position.Y;
position = end;
- Width += x;
- Height += y;
+ actualWidth += x;
+ actualHeight += y;
+
+ if (actualWidth < 0)
+ {
+ Left = actualLeft + actualWidth;
+ Width = -actualWidth;
+ }
+ else
+ {
+ Left = actualLeft;
+ Width = actualWidth;
+ }
+
+ if (actualHeight < 0)
+ {
+ Top = actualTop + actualHeight;
+ Height = -actualHeight;
+ }
+ else
+ {
+ Top = actualTop;
+ Height = actualHeight;
+ }
}
@@ -181,6 +212,10 @@
// By default, nothing has to be 'prepared'
}
+ public override string ToString()
+ {
+ return string.Format("Top: {0} Left: {1} Height: {2}
Width: {3}", Top, Left, Height, Width);
+ }
#endregion Methods
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches