Skip to content

Commit 63eaf35

Browse files
committed
bugfix line drawing in grid, fixes #56
1 parent 4564c77 commit 63eaf35

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

WpfDesign.Designer/Project/Extensions/LineHandlerExtension.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,17 @@ protected virtual void drag_Started(DragListener drag)
104104
Line al = ExtendedItem.View as Line;
105105
CurrentX2 = al.X2;
106106
CurrentY2 = al.Y2;
107-
CurrentLeft = (double)al.GetValue(Canvas.LeftProperty);
108-
CurrentTop = (double)al.GetValue(Canvas.TopProperty);
107+
CurrentLeft = al.Margin.Left;
108+
CurrentTop = al.Margin.Top;
109+
if (ExtendedItem.Parent.View is Canvas)
110+
{
111+
var lp = (double)al.GetValue(Canvas.LeftProperty);
112+
if (!double.IsNaN(lp))
113+
CurrentLeft += lp;
114+
var tp = (double)al.GetValue(Canvas.TopProperty);
115+
if (!double.IsNaN(tp))
116+
CurrentTop += tp;
117+
}
109118

110119
var designPanel = ExtendedItem.Services.DesignPanel as DesignPanel;
111120
zoom = designPanel.TryFindParent<ZoomControl>();

0 commit comments

Comments
 (0)