Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 224ee65

Browse files
Merge pull request #476 from gumme/WpfDesignerResizeThumbAlignmentNull
Wpf designer resize thumb alignment null
2 parents 410813b + c825585 commit 224ee65

2 files changed

Lines changed: 7 additions & 11 deletions

File tree

src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,10 @@ public override void BeforeSetPosition(PlacementOperation operation)
115115
if (Snap(horizontalInput, horizontalMap, Accuracy, out drawLines, out delta)) {
116116

117117
if (operation.Type == PlacementType.Resize) {
118-
if (info.ResizeThumbAlignment.Vertical == VerticalAlignment.Top) {
119-
bounds.Y += delta;
120-
bounds.Height = Math.Max(0, bounds.Height - delta);
121-
} else {
122-
bounds.Height = Math.Max(0, bounds.Height + delta);
118+
if (info.ResizeThumbAlignment != null && info.ResizeThumbAlignment.Value.Vertical == VerticalAlignment.Top) {
119+
bounds.Y += delta;
123120
}
121+
bounds.Height = Math.Max(0, bounds.Height - delta);
124122
info.Bounds = bounds;
125123
} else {
126124
foreach (var item in operation.PlacedItems) {
@@ -138,12 +136,10 @@ public override void BeforeSetPosition(PlacementOperation operation)
138136
if (Snap(verticalInput, verticalMap, Accuracy, out drawLines, out delta)) {
139137

140138
if (operation.Type == PlacementType.Resize) {
141-
if (info.ResizeThumbAlignment.Horizontal == HorizontalAlignment.Left) {
142-
bounds.X += delta;
143-
bounds.Width = Math.Max(0, bounds.Width - delta);
144-
} else {
145-
bounds.Width = Math.Max(0, bounds.Width + delta);
139+
if (info.ResizeThumbAlignment != null && info.ResizeThumbAlignment.Value.Horizontal == HorizontalAlignment.Left) {
140+
bounds.X += delta;
146141
}
142+
bounds.Width = Math.Max(0, bounds.Width - delta);
147143
info.Bounds = bounds;
148144
} else {
149145
foreach (var item in operation.PlacedItems) {

src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementInformation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public Rect Bounds {
7575
/// <summary>
7676
/// Gets/sets the alignment of the resize thumb used to start the operation.
7777
/// </summary>
78-
public PlacementAlignment ResizeThumbAlignment { get; set; }
78+
public PlacementAlignment? ResizeThumbAlignment { get; set; }
7979

8080
/// <inheritdoc/>
8181
public override string ToString()

0 commit comments

Comments
 (0)