Zoom: compose the box as a real 2x layer above the background (Unit: zoom layer + magnification proof)

Right-click now creates a transient ZoomSceneElement at z-index 1 whose pixels are a
genuine 2x magnified sample of the backdrop (live capture under art), composited into
stream/recording like any layer while the output crop stays the tier. All shapes are
centered on the click and clamped to frame; healed on load/scene-create, never persisted,
hidden from the layers list + element template (IsZoomLayer). BuildCompositorOptions is
now internal = always tier crop (test seam). ZoomFrameBuilder is a pure static sampler
(box/2 window centered on the box center, single-slot cache) proven by a banded-backdrop
test; LayerReorderPersistenceTests drag resolves rows by item since the collapsed zoom
row shifts container indices. Also books TASK 51 (webcam background Remove + Blur) and
syncs memory docs (HANDOFF, MyMistakes, indexes). Full suite: 405 passed, 0 warnings.
This commit is contained in:
2026-10-07 23:39:54 -07:00
parent 966e718f1e
commit 4b3d82ff0f
17 changed files with 734 additions and 210 deletions
+21 -12
View File
@@ -94,11 +94,15 @@ public sealed class LayerReorderPersistenceTests
var list = (FocusPreservingListBox)panel.FindName("SourceList")!;
list.UpdateLayout();
// Elements = [Background, ImgA, ImgB, ImgC]. Physically drag ImgC
// (row 3) up onto ImgA (row 1): the handlers reorder live elements to
// [Background, ImgC, ImgA, ImgB] and EndListDrag must persist that.
var from = RowScreenPoint(list, 3);
var to = RowScreenPoint(list, 1);
// Elements = [Background, Zoom(placeholder, collapsed), ImgA, ImgB,
// ImgC]. Physically drag ImgC up onto ImgA: the handlers reorder the
// live elements to [Background, Zoom, ImgC, ImgA, ImgB] and EndListDrag
// must persist that. Rows are resolved BY ITEM — the collapsed zoom row
// shifts container indices, but ItemContainerGenerator maps items to
// their (collapsed = zero-height) containers transparently.
var sources = vm.StagedScene.Elements.OfType<Source>().ToArray();
var from = RowScreenPoint(list, sources.First(s => s.Name == "ImgC"));
var to = RowScreenPoint(list, sources.First(s => s.Name == "ImgA"));
SetCursorPos((int)from.X, (int)from.Y);
LetInputSettle(80);
@@ -133,13 +137,13 @@ public sealed class LayerReorderPersistenceTests
}
}
/// <summary>Screen (device-pixel) point one-third into the list row — over the
/// name TextBlock, away from the per-row buttons/rename TextBox.</summary>
private static Point RowScreenPoint(FocusPreservingListBox list, int index)
/// <summary>Screen (device-pixel) point one-third into an item's list row — over
/// the name TextBlock, away from the per-row buttons/rename TextBox.</summary>
private static Point RowScreenPoint(FocusPreservingListBox list, Models.SceneElement item)
{
var item = (ListBoxItem)list.ItemContainerGenerator.ContainerFromIndex(index)!;
var inList = item.TransformToVisual(list)
.Transform(new Point(Math.Min(30, item.ActualWidth - 12), item.ActualHeight / 2));
var container = (ListBoxItem)list.ItemContainerGenerator.ContainerFromItem(item)!;
var inList = container.TransformToVisual(list)
.Transform(new Point(Math.Min(30, container.ActualWidth - 12), container.ActualHeight / 2));
return list.PointToScreen(inList);
}
@@ -251,7 +255,12 @@ public sealed class LayerReorderPersistenceTests
// Restart: a brand-new LayoutStore reading the same DB must restore
// the cross-type order exactly — webcam between Image and Web
// Resource-0, not appended after all sources.
// Resource-0, not appended after all sources. Only persisted elements
// count: the transient zoom placeholder (TASK 51) is never written,
// so the DB order naturally has no seat for it.
expected = elements.Where(e => e is Source or WebcamSceneConfig)
.Select(e => e.Name).ToArray();
Assert.True(PumpUntil(() =>
TryReadSceneOrder(tempDb, out var names) && names.SequenceEqual(expected),
TimeSpan.FromSeconds(10)),