[DO NOT MERGE] Include Adorners in matrix calculations in VisualExtensions #15484
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.
What does the pull request do?
This PR changes
VisualExtensions::TransformToVisual
to support adorners.What is the current behavior?
Currently
VisualExtensions::TransformToVisual
doesn't work correctly when one of the controls is inside an Adorner Layer. Adorned element is not on a path to root from adorner element. So it is not included in calculations. Adorners are rendered correctly, because the renderer has special handling for adorners. HenceTransformToVisual
needs some special handling too.What is the updated/expected behavior with this PR?
VisualExtensions::TransformToVisual
should correctly take into account adorners.How was the solution implemented (if it's not obvious)?
Unfortunately, adorners are defined in
Avalonia.Controls
whileVisualExtensions
is inAvalonia.Base
, soVisualExtensions
doesn't know what adorners are. Therefore, this PR addsAdornerLayerBase
withAdornedElementProperty
and an emptyIAdornerLayer
toAvalonia.Base
so that this information is available. This is far from perfect, but I don't know how to do it in a cleaner way.Besides, the obvious downside of the solution is additional computation complexity in
VisualExtensions::TransformToVisual
. Each time this method is called, an adorned element needs to be found via calling GetValue(AdornedElementProperty) on each element on path to root.Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues
Fixes #15480