diff --git a/OpenNest.WinForms.Tests/Forms/ShapeLibraryFormTests.cs b/OpenNest.WinForms.Tests/Forms/ShapeLibraryFormTests.cs index ca939aeb..3c693641 100644 --- a/OpenNest.WinForms.Tests/Forms/ShapeLibraryFormTests.cs +++ b/OpenNest.WinForms.Tests/Forms/ShapeLibraryFormTests.cs @@ -221,7 +221,7 @@ public class ShapeLibraryFormTests // The length sits below the drawing: it may come closer, never above its bottom edge. var after = preview.LabelBounds("Length")!.Value; Assert.True(after.Y < before.Y); - Assert.True(after.Y > before.Y - 20); + Assert.True(after.Y > before.Y - 50); }); [Fact] diff --git a/OpenNest/Controls/ShapePreviewControl.cs b/OpenNest/Controls/ShapePreviewControl.cs index abe9127f..05adaa9b 100644 --- a/OpenNest/Controls/ShapePreviewControl.cs +++ b/OpenNest/Controls/ShapePreviewControl.cs @@ -24,14 +24,19 @@ namespace OpenNest.Controls { // Screen sizes, in pixels. Gap, MinimumGap, LeaderClearance and Shoulder are sizes at the // fitted view: they grow and shrink with the zoom, so dimensions stay put on the drawing. - private const float Gap = 18f; + private const float Gap = 50f; private const float ExtensionOverrun = 5f; private const float ArrowLength = 8f; private const float ArrowHalfWidth = 3f; - private const float LeaderClearance = 20f; + private const float LeaderClearance = 30f; private const float Shoulder = 12f; private const float LabelPadding = 3f; + // Between the control's border and the note chips. private const float EdgePadding = 10f; + // Between the control's border and the fitted drawing and its dimensions. + private const float FitPadding = 30f; + // Between the info lines or note chips and the fitted drawing and its dimensions. + private const float FitClearance = 20f; private const float ChipSpacing = 6f; private const int DragThreshold = 3; // How close a dragged linear dimension may come to the drawing's bounds. @@ -220,9 +225,11 @@ namespace OpenNest.Controls return; } - var top = EdgePadding + InfoHeight(); - var bottom = EdgePadding + ChipRowsHeight(); - float left = EdgePadding, right = EdgePadding; + var info = InfoHeight(); + var chips = ChipRowsHeight(); + var top = info > 0 ? System.Math.Max(FitPadding, info + FitClearance) : FitPadding; + var bottom = chips > 0 ? System.Math.Max(FitPadding, EdgePadding + chips + FitClearance) : FitPadding; + float left = FitPadding, right = FitPadding; float reachLeft = 0, reachRight = 0, reachTop = 0, reachBottom = 0; for (var pass = 0; pass < 3; pass++)