Author: alanmc
Date: 2007-07-11 15:41:14 -0400 (Wed, 11 Jul 2007)
New Revision: 81828

Modified:
   trunk/lunareclipse/ChangeLog
   trunk/lunareclipse/Model/Draw/SelectionDraw.cs
   trunk/lunareclipse/Model/SelectedBorder.cs
Log:
* Model/SelectedBorder.cs, Model/Draw/SelectionDraw.cs: Much cleaner
  rotating now. Using RenderTransformOrigin to specifiy the offset at
  which the transform should be applied

Modified: trunk/lunareclipse/ChangeLog
===================================================================
--- trunk/lunareclipse/ChangeLog        2007-07-11 19:06:02 UTC (rev 81827)
+++ trunk/lunareclipse/ChangeLog        2007-07-11 19:41:14 UTC (rev 81828)
@@ -1,5 +1,11 @@
 2007-07-11  Alan McGovern <[EMAIL PROTECTED]> 
 
+       * Model/SelectedBorder.cs, Model/Draw/SelectionDraw.cs: Much cleaner
+         rotating now. Using RenderTransformOrigin to specifiy the offset at
+         which the transform should be applied
+
+2007-07-11  Alan McGovern <[EMAIL PROTECTED]> 
+
        * Model/SelectedBorder.cs: Resetting the rotation to be about the
          correct point in the shape after the shape is altered
        * Properties/PropertyGroupLayout.cs,

Modified: trunk/lunareclipse/Model/Draw/SelectionDraw.cs
===================================================================
--- trunk/lunareclipse/Model/Draw/SelectionDraw.cs      2007-07-11 19:06:02 UTC 
(rev 81827)
+++ trunk/lunareclipse/Model/Draw/SelectionDraw.cs      2007-07-11 19:41:14 UTC 
(rev 81828)
@@ -259,7 +259,8 @@
                 double slope1 = (mouseStart.Y - center.Y) / (mouseStart.X - 
center.X);
                 double slope2 = (Position.Y - center.Y) / (Position.X - 
center.X);
                 double difference = Math.Atan((slope2 - slope1) / ( 1 + slope1 
* slope2));
-                b.RotateTransform.Angle += difference * 360 / (2 * Math.PI);
+                if(!double.IsNaN(difference))
+                    b.RotateTransform.Angle += difference * 360 / (2 * 
Math.PI);
                 break;
                 
                 case MoveType.Standard:

Modified: trunk/lunareclipse/Model/SelectedBorder.cs
===================================================================
--- trunk/lunareclipse/Model/SelectedBorder.cs  2007-07-11 19:06:02 UTC (rev 
81827)
+++ trunk/lunareclipse/Model/SelectedBorder.cs  2007-07-11 19:41:14 UTC (rev 
81828)
@@ -42,8 +42,8 @@
             get { return 
(RotateTransform)this.child.GetValue(RenderTransformProperty); }
             set 
             { 
-                this.child.SetValue<object>(RenderTransformProperty, value); 
-                base.SetValue<object>(RenderTransformProperty, value);
+                this.child.SetValue<RotateTransform>(RenderTransformProperty, 
value); 
+                base.SetValue<RotateTransform>(RenderTransformProperty, value);
             }
         }
         
@@ -68,15 +68,13 @@
                     DrawHandles();
                     updating = false;
                 }
+
+                child.SetValue<Point>(RenderTransformOriginProperty, new 
Point(0.5, 0.5));
+                base.SetValue<Point>(RenderTransformOriginProperty, new 
Point(0.5, 0.5));
                 
-                if(child.GetValue(RenderTransformProperty) == null)
-                {
-                    RotateTransform t = new RotateTransform();
-                    t.Angle = 0;
-                    t.CenterX = (double)child.GetValue(WidthProperty) * 0.5;
-                    t.CenterY = (double)child.GetValue(HeightProperty) * 0.5;
-                    RotateTransform = t;
-                }
+                if(RotateTransform == null)
+                    RotateTransform = new RotateTransform();
+                base.SetValue<RotateTransform>(RenderTransformProperty, 
RotateTransform);
             }
         }
             
@@ -114,24 +112,9 @@
             base.SetValue<double>(HeightProperty, childHeight + BorderWidth * 
2);
 
             DrawHandles();
-            DrawTransform();
+            //DrawTransform();
         }
         
-        private void DrawTransform()
-        {
-            RotateTransform current = this.RotateTransform;
-            if(current == null)
-                return;
-            
-            current.CenterX = (double)Child.GetValue(WidthProperty) * 0.5;
-            current.CenterY = (double)Child.GetValue(HeightProperty) * 0.5;
-            RotateTransform copy = new RotateTransform();
-            copy.Angle = current.Angle;
-            copy.CenterX = current.CenterX + BorderWidth;
-            copy.CenterY = current.CenterY + BorderWidth;
-            base.SetValue<object>(RenderTransformProperty, copy);
-        }
-        
         private void DrawHandles()
         {
             VisualCollection Children = 
(VisualCollection)base.GetValue(ChildrenProperty);

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

Reply via email to