[Android] Fixed TransformProperties issue when a wrapper view is present#29228
[Android] Fixed TransformProperties issue when a wrapper view is present#29228jfversluis merged 9 commits intodotnet:inflight/currentfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the issue where the scaling transformation was not applied correctly when an image is wrapped inside a container view (WrapperView) on Android. The changes update the transform properties calculation to apply these properties to the WrapperView instead of the inner view and add corresponding UI tests to validate the fix.
- Calculate pivot points and other transform properties based on the actual view (either the WrapperView or the original view).
- When a WrapperView is detected, apply transform properties on it and reset non-transform values on the inner view.
- Added automated tests in both the shared and host app test suites to verify the corrected behavior.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Core/src/Platform/Android/ViewExtensions.cs | Updated transform properties calculations to account for WrapperView presence |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue7432.cs | Added automated UI test for Issue7432 |
| src/Controls/tests/TestCases.HostApp/Issues/Issue7432.cs | Added test UI page for Issue7432 to simulate the issue |
| var pivotX = (float)(view.AnchorX * transformView.ToPixels(view.Frame.Width)); | ||
| var pivotY = (float)(view.AnchorY * transformView.ToPixels(view.Frame.Height)); | ||
|
|
There was a problem hiding this comment.
Ensure that using 'transformView' for calculating pivot accurately reflects the intended pixel conversion when a WrapperView is present. Verify that the view.Frame dimensions used remain valid for the WrapperView's coordinate context.
| var pivotX = (float)(view.AnchorX * transformView.ToPixels(view.Frame.Width)); | |
| var pivotY = (float)(view.AnchorY * transformView.ToPixels(view.Frame.Height)); | |
| float pivotX, pivotY; | |
| if (wrapperView is not null) | |
| { | |
| // Use WrapperView's coordinate context for pixel conversion | |
| pivotX = (float)(view.AnchorX * wrapperView.ToPixels(view.Frame.Width)); | |
| pivotY = (float)(view.AnchorY * wrapperView.ToPixels(view.Frame.Height)); | |
| } | |
| else | |
| { | |
| // Use platformView's coordinate context for pixel conversion | |
| pivotX = (float)(view.AnchorX * platformView.ToPixels(view.Frame.Width)); | |
| pivotY = (float)(view.AnchorY * platformView.ToPixels(view.Frame.Height)); | |
| } |
| wrapperView.PivotY = pivotY; | ||
|
|
||
| // Apply non-transform properties to the inner view | ||
| PlatformInterop.Set(platformView, |
There was a problem hiding this comment.
This is duplicated two times, can create a method with all the transformation properties as parameters?
There was a problem hiding this comment.
I have made the changes. please let me know if you have any other concerns. @jsuarezruiz
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
I have resaved the correct image. @jsuarezruiz |
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…d by WrapperView container
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 29228Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 29228" |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [Microsoft.Extensions.Logging.Debug](https://dot.net/) ([source](https://github.com/dotnet/dotnet)) | nuget | patch | `10.0.3` -> `10.0.4` | | [Microsoft.Maui.Controls](https://github.com/dotnet/maui) | nuget | patch | `10.0.41` -> `10.0.50` | --- ### Release Notes <details> <summary>dotnet/maui (Microsoft.Maui.Controls)</summary> ### [`v10.0.50`](https://github.com/dotnet/maui/releases/tag/10.0.50) [Compare Source](dotnet/maui@10.0.41...10.0.50) #### What's Changed .NET MAUI 10.0.50 introduces significant improvements across all platforms with focus on quality, performance, and developer experience. This release includes 78 commits with various improvements, bug fixes, and enhancements. #### AI - Enable packing and independent preview versioning for Essentials.AI by [@​mattleibow](https://github.com/mattleibow) in dotnet/maui#33976 - Move Essentials.AI preview iteration to eng/Versions.props by [@​mattleibow](https://github.com/mattleibow) in dotnet/maui#34025 - \[Feature] Add Microsoft.Maui.Essentials.AI - Apple Intelligence by [@​mattleibow](https://github.com/mattleibow) in dotnet/maui#33519 #### Ai Agents - Copilot agent infrastructure, emulator reliability, and try-fix workflow improvements by [@​PureWeen](https://github.com/PureWeen) via [@​Copilot](https://github.com/Copilot) in dotnet/maui#33937 - Update PR agent models to claude-sonnet-4.6 and gpt-5.3-codex by [@​kubaflo](https://github.com/kubaflo) in dotnet/maui#34109 - ci-copilot: set pipeline run title early using build.updatebuildnumber by [@​jfversluis](https://github.com/jfversluis) via [@​Copilot](https://github.com/Copilot) in dotnet/maui#34156 - Revamp find-reviewable-pr skill: priorities, defaults, and doc fixes by [@​PureWeen](https://github.com/PureWeen) in dotnet/maui#34160 - Add correct CI pipeline names to Copilot instructions by [@​jfversluis](https://github.com/jfversluis) in dotnet/maui#34255 - Add resilience to UI tests for frozen/unresponsive apps by [@​PureWeen](https://github.com/PureWeen) in dotnet/maui#34023 - Copilot CI: Structured phase outputs, autonomous execution, iOS support, and CI pipeline by [@​kubaflo](https://github.com/kubaflo) in dotnet/maui#34040 - Agent Workflow Metrics via GitHub Labels by [@​kubaflo](https://github.com/kubaflo) in dotnet/maui#33986 #### Animation - \[Android] Fixed TransformProperties issue when a wrapper view is present by [@​Ahamed-Ali](https://github.com/Ahamed-Ali) in dotnet/maui#29228 <...


Root Cause of the issue
wrappedinside a container view(WrapperView). However, when scaling is applied to the image, the container view (WrapperView) does not account for thescaling, resulting in incorrect rendering.Description of Change
container viewitself when a background color is present, ensuring proper rendering and consistent behavior.Issues Fixed
Fixes #7432
Tested the behaviour in the following platforms
Screenshot