Skip to content

Add declarative IsHitTestVisible(bool) common element modifier#810

Open
nsreehari wants to merge 1 commit into
microsoft:mainfrom
nsreehari:nsreehari/issue-809-is-hit-test-visible
Open

Add declarative IsHitTestVisible(bool) common element modifier#810
nsreehari wants to merge 1 commit into
microsoft:mainfrom
nsreehari:nsreehari/issue-809-is-hit-test-visible

Conversation

@nsreehari

Copy link
Copy Markdown

Summary

Adds a declarative IsHitTestVisible(bool) modifier to the common element surface, filling the last gap among the sibling boolean/visual state modifiers (IsEnabled, IsTabStop, IsVisible, Opacity). Until now, opting an element out of pointer hit-testing required the imperative .Set(c => c.IsHitTestVisible = false) escape hatch.

Fixes #809.

Motivation

Reactor.Community.ReactorFlow's MiniMap renders pointer-transparent overlay layers (viewport rectangle, node thumbnails) that must not intercept pointer input destined for the interactive canvas underneath. Its last remaining .Set(...) escape hatch is a NonInteractive helper whose entire body is element.Set(c => c.IsHitTestVisible = false). A declarative modifier lets that helper be dropped and the property composed like any other element state.

What changed

Plumbing mirrors IsTabStop exactly:

  • src/Reactor/Core/Element.cs — added bool? IsHitTestVisible to ElementModifiers, folded into ModifiersEqual and Merge.
  • src/Reactor/Elements/ElementExtensions.cs — added public static T IsHitTestVisible<T>(this T el, bool isHitTestVisible = true) where T : Element next to IsTabStop, with matching XML-doc style.
  • src/Reactor/Core/Reconciler.cs — applies fe.IsHitTestVisible = value only when set and changed, next to where IsTabStop is applied.
  • tests/Reactor.Tests/ElementExtensionsCoverageTests.cs — added IsHitTestVisible_Sets_Modifier, mirroring IsEnabled_Sets_Modifier.
  • skills/reactor.api.txt + plugins/reactor/skills/reactor-dsl/references/reactor.api.txt — regenerated API index (UPDATE_API_INDEX=1).

Additive and back-compat: new optional modifier defaulting to true (the WinUI default); no existing signature or behavior changes. Recycle-safety is already covered — ElementPool clears UIElement.IsHitTestVisibleProperty on release (issue #162), so a recycled control cannot strand a stale false.

Validation

Built and tested on win-x64:

UPDATE_API_INDEX=1 dotnet test tests/Reactor.Tests \
  --filter "FullyQualifiedName~Tooling.ApiIndexGeneratorTests.Index_IsUpToDate" -r win-x64
# → regenerated both reactor.api.txt copies; Passed 1

dotnet test tests/Reactor.Tests \
  --filter "FullyQualifiedName~ElementExtensionsCoverageTests|FullyQualifiedName~Tooling.ApiIndexGeneratorTests" \
  -r win-x64 --no-build
# → Passed 63, Failed 0 (incl. IsHitTestVisible_Sets_Modifier and Index_IsUpToDate)

Build succeeded with 0 errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add declarative IsHitTestVisible(bool) modifier on the common element surface

1 participant