From 755d653ef7a8995403a9ad7e397de1dfeaac484c Mon Sep 17 00:00:00 2001 From: jkuehner Date: Mon, 29 Dec 2014 20:19:56 +0100 Subject: [PATCH] A few fixes on the Geometry Extensions --- .../Project/Extensions/DrawPathExtension.cs | 1 + .../PointTrackerPlacementSupport.cs | 10 ++------ .../Extensions/PolyLineHandlerExtension.cs | 24 +------------------ 3 files changed, 4 insertions(+), 31 deletions(-) diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/DrawPathExtension.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/DrawPathExtension.cs index ef81f9ad74..d837a62f43 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/DrawPathExtension.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/DrawPathExtension.cs @@ -134,6 +134,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions { base.OnMouseDoubleClick(sender, e); + figure.Segments.RemoveAt(figure.Segments.Count - 1); geometry.Properties[PathGeometry.FiguresProperty].SetValue(figure.ToString()); if (changeGroup != null) { diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PointTrackerPlacementSupport.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PointTrackerPlacementSupport.cs index 6385a1a2ec..7e0e8dae20 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PointTrackerPlacementSupport.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PointTrackerPlacementSupport.cs @@ -66,17 +66,11 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions } p = new Point(x, y); } else if (shape is Polygon) { - if (Index > 0) - { var pg = shape as Polygon; p = pg.Points[Index]; - } } else if (shape is Polyline) { - if (Index > 0) - { - var pg = shape as Polyline; - p = pg.Points[Index]; - } + var pg = shape as Polyline; + p = pg.Points[Index]; } else if (shape is Path) { if (Index > 0) { diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PolyLineHandlerExtension.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PolyLineHandlerExtension.cs index 0a9d75e7e7..7aee687777 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PolyLineHandlerExtension.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PolyLineHandlerExtension.cs @@ -157,27 +157,6 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions _isResizing = true; } - void ChangeOperation(PointCollection points) - { - //this is for SharpDevelop built in undo functionality - if (operation != null) - { - var info = operation.PlacedItems[0]; - var result = info.OriginalBounds; - - IEnumerable xs = points.Select(x => x.X); - IEnumerable ys = points.Select(y => y.Y); - result.X = (double)(info.Item.Properties.GetAttachedProperty(Canvas.LeftProperty).ValueOnInstance); - result.Y = (double)(info.Item.Properties.GetAttachedProperty(Canvas.TopProperty).ValueOnInstance); - result.Width = xs.Max() - xs.Min(); - result.Height = ys.Max() - ys.Min(); - - info.Bounds = result.Round(); - operation.CurrentContainerBehavior.BeforeSetPosition(operation); - operation.CurrentContainerBehavior.SetPosition(info); - } - } - void CommitOperation() { if (operation != null) @@ -298,7 +277,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions points = MovePoints(points, dx, dy, theta, snapAngle); } - ChangeOperation(points); + (drag.Target as ResizeThumb).InvalidateArrange(); } @@ -415,7 +394,6 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions var dx2 = (e.Key == Key.Right) ? Keyboard.IsKeyDown(Key.LeftShift) ? _movingDistance + 10 : _movingDistance + 1 : 0; var dy2 = (e.Key == Key.Down) ? Keyboard.IsKeyDown(Key.LeftShift) ? _movingDistance + 10 : _movingDistance + 1 : 0; - ChangeOperation(MovePoints(GetPointCollection(), dx1 + dx2, dy1 + dy2, 0, null)); _movingDistance = (dx1 + dx2 + dy1 + dy2); }