fix(brand): one logo, not two — and hit-testing follows what you see
The brand exemption for the universal blur put a BrandLogoOverlay above the blur host while the canvas ItemsControl kept drawing the same element, so two logos sat on top of each other. - The canvas presenter for a brand logo is collapsed: BrandLogoOverlay is the only render, and it now carries the element's Opacity so the canvas copy is not missed. - Hit-testing follows the eye: a click inside the logo's bounds selects the logo, because it is the topmost layer in the compositor too. Without that you saw the logo on top and grabbed the webcam underneath it. - SelectedLayerPreviewHitTestingTests updated to the new contract (collapsed presenter, logo wins its bounds, list selection still works). 3 tests pass; Release 0 warnings.
This commit is contained in:
@@ -71,26 +71,35 @@ public sealed class SelectedLayerPreviewHitTestingTests
|
||||
var pointInCanvas = new Point(logo.X + 100, logo.Y + 60);
|
||||
var pointInWindow = canvasGrid.TransformToVisual(window).Transform(pointInCanvas);
|
||||
|
||||
Assert.True(ReferenceEquals(webcam, ElementAt(window.InputHitTest(pointInWindow))));
|
||||
Assert.Same(webcam, preview.HitElementAt(vm, pointInCanvas));
|
||||
Assert.Equal(0, Panel.GetZIndex(logoContainer));
|
||||
// The brand logo is drawn in BrandLogoOverlay above the blur host (2026-11-01), so its
|
||||
// canvas presenter is collapsed and the overlay is what the eye sees. Hit-testing
|
||||
// follows the eye: the logo wins a click inside its bounds.
|
||||
Assert.Equal(Visibility.Collapsed, logoContainer.Visibility);
|
||||
Assert.Same(logo, preview.HitElementAt(vm, pointInCanvas));
|
||||
|
||||
sourceList.SelectedItem = logo;
|
||||
window.UpdateLayout();
|
||||
|
||||
Assert.True(ReferenceEquals(logo, vm.SelectedElement), "Selecting the layer-list row must select the brand logo.");
|
||||
Assert.True(Panel.GetZIndex(logoContainer) > Panel.GetZIndex(webcamContainer));
|
||||
Assert.Same(logo, ElementAt(window.InputHitTest(pointInWindow)));
|
||||
Assert.Same(logo, preview.HitElementAt(vm, pointInCanvas));
|
||||
|
||||
// …and with nothing selected the logo still wins inside its own bounds, because it is
|
||||
// drawn above every layer. The webcam shares that rect in this test, so it is the
|
||||
// covered case: you reach it from the layer list, not by clicking through the logo.
|
||||
vm.SelectedElement = null;
|
||||
window.UpdateLayout();
|
||||
Assert.Same(logo, preview.HitElementAt(vm, new Point(logo.X + 5, logo.Y + 5)));
|
||||
Assert.Equal(originalOrder, scene.Elements);
|
||||
|
||||
sourceList.SelectedItem = null;
|
||||
window.UpdateLayout();
|
||||
|
||||
Assert.Null(vm.SelectedElement);
|
||||
Assert.Equal(0, Panel.GetZIndex(logoContainer));
|
||||
Assert.Same(webcam, ElementAt(window.InputHitTest(pointInWindow)));
|
||||
Assert.Same(webcam, preview.HitElementAt(vm, pointInCanvas));
|
||||
// The logo still owns a click inside its bounds after deselection (it is the topmost
|
||||
// layer in both the compositor and the preview), and the canvas presenter stays
|
||||
// collapsed because BrandLogoOverlay is what draws it.
|
||||
Assert.Equal(Visibility.Collapsed, logoContainer.Visibility);
|
||||
Assert.Same(logo, preview.HitElementAt(vm, pointInCanvas));
|
||||
Assert.Equal(originalOrder, scene.Elements);
|
||||
}
|
||||
finally
|
||||
|
||||
Reference in New Issue
Block a user