Browse Source

Merge pull request #476 from gumme/WpfDesignerResizeThumbAlignmentNull

Wpf designer resize thumb alignment null
pull/480/head
Siegfried Pammer 11 years ago
parent
commit
224ee65483
  1. 12
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs
  2. 2
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementInformation.cs

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

@ -115,12 +115,10 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
if (Snap(horizontalInput, horizontalMap, Accuracy, out drawLines, out delta)) { if (Snap(horizontalInput, horizontalMap, Accuracy, out drawLines, out delta)) {
if (operation.Type == PlacementType.Resize) { 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.Y += delta;
bounds.Height = Math.Max(0, bounds.Height - delta);
} else {
bounds.Height = Math.Max(0, bounds.Height + delta);
} }
bounds.Height = Math.Max(0, bounds.Height - delta);
info.Bounds = bounds; info.Bounds = bounds;
} else { } else {
foreach (var item in operation.PlacedItems) { foreach (var item in operation.PlacedItems) {
@ -138,12 +136,10 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
if (Snap(verticalInput, verticalMap, Accuracy, out drawLines, out delta)) { if (Snap(verticalInput, verticalMap, Accuracy, out drawLines, out delta)) {
if (operation.Type == PlacementType.Resize) { 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.X += delta;
bounds.Width = Math.Max(0, bounds.Width - delta);
} else {
bounds.Width = Math.Max(0, bounds.Width + delta);
} }
bounds.Width = Math.Max(0, bounds.Width - delta);
info.Bounds = bounds; info.Bounds = bounds;
} else { } else {
foreach (var item in operation.PlacedItems) { foreach (var item in operation.PlacedItems) {

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

@ -75,7 +75,7 @@ namespace ICSharpCode.WpfDesign
/// <summary> /// <summary>
/// Gets/sets the alignment of the resize thumb used to start the operation. /// Gets/sets the alignment of the resize thumb used to start the operation.
/// </summary> /// </summary>
public PlacementAlignment ResizeThumbAlignment { get; set; } public PlacementAlignment? ResizeThumbAlignment { get; set; }
/// <inheritdoc/> /// <inheritdoc/>
public override string ToString() public override string ToString()

Loading…
Cancel
Save