-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Path Geometry update fix for 4748 bug rerender on change for paths segments #18025
base: master
Are you sure you want to change the base?
Path Geometry update fix for 4748 bug rerender on change for paths segments #18025
Conversation
AvaloniaUI#4748 [BUG] Rerender on change for Paths, Segments and e.g. Failing Test
Fixes AvaloniaUI#4748 [BUG] Rerender on change for Paths, Segments and e.g.
You can test this PR using the following package version. |
|
@cla-avalonia agree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good find
We have some Path samples in RenderDemo project IIRC. Probably not necessarily overall.
InvalidateGeometry is rather an implementation detail, which is expected to be eventually phased out, as we plan to move such invalidation to the rendering compositor resources. |
Thanks!
Got it.
I was thinking it wasn't ideal to need to look into protected method invocation for the tests either, I was initially just focused on that is the method to be sure invalidation occurs in the current implementation. I can change them all to checking for Changed events instead. Would you like a separate PR for those additional coverage tests? |
What does the pull request do?
Fixes #4748 [BUG] Rerender on change for Paths, Segments and e.g.
I found this issue independently when trying to bind to
PolyLineSegment.Points
. Ex:I would not see the path update in the combo box selection after picking another item.
It appears to be the same root cause as #4748
What is the current behavior?
Updates to path geometry (figures, segments, etc) do not trigger an
InvalidateGeometry()
call so the parent path is not re-rendered as expected. Specifically changes toPathGeometry.Figures
do not triggerOnFiguresChanged
.What is the updated/expected behavior with this PR?
Updates to
PathGeometry.Figures
should now triggerOnFiguresChanged
where the existing code can then properly callInvalidateGeometry()
as appropriate.How was the solution implemented (if it's not obvious)?
I initially thought this was a more involved issue that needed changes to all the geometry classes where child geometry would need to invalidate their parent on property changes through an AffectsGeometry<>(Properties) type solution.
However, in further debugging and testing the root issue turns out to only need a one-liner fix. Using the property
Figures
instead of the private member_figures
directly when setting the initialPathFigures
object inPathGeometry
allows the existing code to monitor the changes properly and invalidate the parent path geometry.Checklist
Fixed issues
Fixes #4748 [BUG] Rerender on change for Paths, Segments and e.g.
Additional Work
I had made some additions to the ControlCatalog demonstrating various path geometries and bindings as part of testing this bug. Would those be considered a feature change and need a new ticket for discussion?
I also have additional tests written (not included in this PR) for verifying the internal
InvalidateGeometry()
calls are made on all geometry and property changes. This was done initially to validate my initial solution before finding this one-liner fix. These additional tests currently pass separate from this fix, as thePathGeometry.Figures
is the only link in the chain that appears broken in triggering the final InvalidateGeometry(). The additional tests are currently written using using Moq.Protected to verify the InvalidateGeometry() calls. Would you like those additional coverage tests added and considered as part of the PR, or best to consider those as a separate PR for additional test coverage and keep this PR simple?In this PR, I've only included the single test targeted to the root cause that fails and then passes as part of this PR.