Merged
Conversation
…t-for-skmatrix Add ShimSkiaSharp unit tests
…kpath-and-related-classes Add ShimSkiaSharp unit tests
…-getbounds-and-line-hit-testing Improve path bounds and line hit test
…failure-in-hittest_patharc_point Fix arc hit test expectation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds basic SVG hit testing support and integrates it into the sample app’s UI, along with unit tests.
- Expose
HitTestElementsandHitTestDrawablesonSKSvgand implement their logic via a newHitTestService - Hook into the Avalonia control’s draw pipeline to optionally render hit‐test bounds
- Add unit tests covering point hit testing and rectangle intersection
Reviewed Changes
Copilot reviewed 55 out of 62 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Svg.Skia/SKSvg.HitTest.cs | Implemented hit testing methods on SKSvg |
| src/Svg.Model/Services/HitTestService.cs | New HitTestService for point/rect hit logic |
| tests/Svg.Skia.UnitTests/HitTestTests.cs | Added unit tests for element hit testing |
| src/Svg.Controls.Skia.Avalonia/SvgSourceCustomDrawOperation.cs | Updated draw op to call SKSvg.Draw and raise events |
Comments suppressed due to low confidence (2)
tests/Svg.Skia.UnitTests/HitTestTests.cs:27
- Tests currently cover point hit tests but there are no tests for rectangle-based hit tests. Consider adding a unit test for
HitTestElements(SKRect)orHitTestDrawables(SKRect)to ensure that bounding‐box queries also work.
public void HitTest_Point_OuterOnly()
samples/TestApp/Views/MainView.axaml.cs:37
- [nitpick] If two different
SKSvginstances are swapped rapidly, the old event handler may not be unsubscribed correctly. It might be safer to always check and unsubscribe from any existing instance before assigning the new one.
private void SubscribeOnDraw()
…code-improvements Improve arc bounds and docs
…ash-in-testapp Fix asset loader metrics fallback
…ion-to-readme Add README hit-testing section
This was referenced Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing
dotnet build tests/Svg.Skia.UnitTests/Svg.Skia.UnitTests.csproj -c Release(fails: missing svg11.dtd resource)https://chatgpt.com/codex/tasks/task_e_6873bc6f21848321bddcd4d6464484ae