fix(fill): refill clamp gaps when Ctrl+F fills one part

The copy tool's Ctrl+F fills through FillGroup, which only dropped the
parts that hit a clamp. A single part now fills through FillItem, so it
also takes the gaps those drops leave (N26-2J7: 194 -> 195 parts).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ajandClaude Opus 5.5 committed 2026-12-01 15:31:25 -05:00
1 parent 6a10f2a959
commit 5bc39be8ca
2 files changed
+21

No files matched your search

@@ -434,6 +434,21 @@ public class ClampZoneInteractiveFillTests
Assert.Equal(58, parts.Count);
}
[Fact]
public void SinglePartGroupFillTakesTheGapBesideTheClamps()
{
// The desktop's Ctrl+F fill passes the copied part as a group of one; it must refill
// the gap the dropped clamp hits leave, as the item fill does.
var plate = RailPlate(out var zones);
var group = new List<Part> { new(RectDrawing(15, 7)) };
var parts = PlateFillService.FillGroup("Fill", plate, group, plate.WorkArea(),
null, CancellationToken.None);
AssertClearOfClamps(parts, zones);
Assert.Equal(58, parts.Count);
}
[Fact]
public void TheClampedRowLinesUpBetweenTheClamps()
{
@@ -336,6 +336,12 @@ public static partial class PlateFillService
if (!InteractiveClamps.HasZones(plate))
return filler.Fill(groupParts, workArea, progress, token);
// One part fills as its drawing (PlateFiller.Fill does the same), so it also gets
// FillItem's refill of the gaps the dropped clamp hits leave.
if (groupParts.Count == 1)
return FillItem(strategy, plate, new NestItem { Drawing = groupParts[0].BaseDrawing },
workArea, progress, token);
// As FillItem; a copy is dropped whole when any member hits a clamp.
var groupSize = groupParts.Count;
return FillBesideClamps(filler, plate, workArea, progress, token, (area, sink) =>