From 966e718f1e371dfc0cc05b48354dbb084979fc67 Mon Sep 17 00:00:00 2001 From: gramps Date: Wed, 7 Oct 2026 20:46:45 -0700 Subject: [PATCH] Zoom: fix preview zoom box + shape-aspect anchoring (Unit: zoom box visuals) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Right-click in the live preview now procs a box that is actually visible and populated with the zoomed region, and each Zoom View Shape sculpts the box per spec. OBS-style derivative: magnifier box shows the composited region and dims the surroundings (same pattern as OBS "zoom" / preview region highlights). Root causes of the invisible box (two WPF traps, recorded in MyMistakes.md): - Empty used as an OpacityMask paints nothing, so the mask alpha is 0 and the WHOLE box (border included) went transparent. - ZoomBox lived inside CanvasGrid while its VisualBrush sampled CanvasGrid — a circular reference WPF renders as nothing. Hoisted ZoomBox to a sibling of CanvasGrid inside a new PreviewCanvas wrapper (same 1920x1080 space). Shape semantics (MainViewModel.ActivateZoom): - Circle: square, click point = center. - VerticalRectangle (phone): tall 9:16, click point = top-left corner. - HorizontalRectangle (tablet): wide 16:9, click point = top-left corner. - Boxes stay fully inside 1920x1080 via Math.Clamp. UI: ZoomRectOutline/ZoomCircleOutline shapes replace the square Border; circle clips the box to an EllipseGeometry; brush Visual released when inactive. Zoom View Shape dropdown now uses the standard YtComboBox style. Test (Good Dog rule, one integration test): ZoomBoxInteractionTests verifies aspect/anchoring/clamp per shape and the matching outline+clip in the real MainWindow. Full suite 404 passed, 0 warnings. Memory: HANDOFF.md zoom state updated; WPF VisualBrush traps appended to MyMistakes.md. --- Controls/OverlayHost.xaml | 11 +- Controls/PreviewPane.xaml | 30 +- Controls/PreviewPane.xaml.cs | 125 +++- HANDOFF.md | 578 ++---------------- Models/ZoomShape.cs | 8 + Models/ZoomState.cs | 20 + MyMistakes.md | 19 + Services/LayoutStore.Settings.cs | 4 +- ViewModels/MainViewModel.Overlays.cs | 14 + .../MainViewModel.Streaming.Operations.cs | 10 + ViewModels/MainViewModel.Streaming.cs | 8 +- ViewModels/MainViewModel.cs | 164 ++++- ytLive.Tests/ZoomBoxInteractionTests.cs | 106 ++++ 13 files changed, 530 insertions(+), 567 deletions(-) create mode 100644 Models/ZoomShape.cs create mode 100644 Models/ZoomState.cs create mode 100644 ytLive.Tests/ZoomBoxInteractionTests.cs diff --git a/Controls/OverlayHost.xaml b/Controls/OverlayHost.xaml index 3d98564..c3224fa 100644 --- a/Controls/OverlayHost.xaml +++ b/Controls/OverlayHost.xaml @@ -1,7 +1,8 @@ + xmlns:Helpers="clr-namespace:ytLive.Helpers" + xmlns:Models="clr-namespace:ytLive.Models">