From c410a20a75f39d1e9ab07385641db18d2655cba8 Mon Sep 17 00:00:00 2001 From: tbulle Date: Thu, 8 May 2014 14:52:30 +0200 Subject: [PATCH] Nullable ResizeThumbAlignment to enable both top and bottom snap on resize simultaneously --- .../Project/Extensions/SnaplinePlacementBehavior.cs | 4 ++-- .../WpfDesign/WpfDesign/Project/PlacementInformation.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs index 67868fbfb7..8242243e39 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs @@ -115,7 +115,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions if (Snap(horizontalInput, horizontalMap, Accuracy, out drawLines, out delta)) { if (operation.Type == PlacementType.Resize) { - if (info.ResizeThumbAlignment.Vertical == VerticalAlignment.Top) { + if (info.ResizeThumbAlignment != null && info.ResizeThumbAlignment.Value.Vertical == VerticalAlignment.Top) { bounds.Y += delta; bounds.Height = Math.Max(0, bounds.Height - delta); } else { @@ -138,7 +138,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions if (Snap(verticalInput, verticalMap, Accuracy, out drawLines, out delta)) { if (operation.Type == PlacementType.Resize) { - if (info.ResizeThumbAlignment.Horizontal == HorizontalAlignment.Left) { + if (info.ResizeThumbAlignment != null && info.ResizeThumbAlignment.Value.Horizontal == HorizontalAlignment.Left) { bounds.X += delta; bounds.Width = Math.Max(0, bounds.Width - delta); } else { diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementInformation.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementInformation.cs index fa880e42ed..34832763b3 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementInformation.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementInformation.cs @@ -75,7 +75,7 @@ namespace ICSharpCode.WpfDesign /// /// Gets/sets the alignment of the resize thumb used to start the operation. /// - public PlacementAlignment ResizeThumbAlignment { get; set; } + public PlacementAlignment? ResizeThumbAlignment { get; set; } /// public override string ToString()