Skip to content

Honor RenderTransformOrigin in CompositeTransform - #23163

Merged
MartinZikmund merged 2 commits into
unoplatform:masterfrom
MartinZikmund:dev/mazi/misaligned-transform
May 2, 2026
Merged

MartinZikmund merged 2 commits into
unoplatform:masterfrom
MartinZikmund:dev/mazi/misaligned-transform

Conversation

@MartinZikmund

Copy link
Copy Markdown
Member

Summary

  • CompositeTransform.ToMatrix(absoluteOrigin) was passing the origin-adjusted center only to Scale, leaving Skew and Rotate pivoting on the raw CenterX/CenterY. Routes the combined center into all three sub-transforms (matching WinUI's Translate(-C) * Scale * Skew * Rotate * Translate(C+t) ordering) and renames the locals so the case-only collision with the property names can no longer hide a regression.
  • Adds Given_CompositeTransform runtime tests that host elements with the broken parameter combinations (rotation, skew, scale, origin + local-center stacking, the user's clock-hand 14×200 case) and assert mappings via TransformToVisual. Coverage runs on every backend including native WinUI as a parity check.

Closes #23162.

Test plan

  • Given_CompositeTransform runtime tests pass on Skia Desktop (8/8)
  • Given_CompositeTransform runtime tests pass on native WinUI (parity check)
  • Confirmed the new tests fail on the previous (buggy) code: 5/8 fail in the exact configurations that exercise origin + Skew/Rotate
  • Verified the user's clock-hand repro renders correctly with the fix on Skia Desktop

🤖 Generated with Claude Code

MartinZikmund and others added 2 commits April 30, 2026 14:02
Only the Scale sub-transform was using the origin-adjusted center; Skew
and Rotate fell back to the raw CenterX/CenterY, so a non-zero
RenderTransformOrigin was silently ignored for any composite that
included rotation or skew. Routes the combined center into all three
sub-transforms and renames the locals so the case-only difference with
the property names can no longer hide a regression.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Hosts elements with the broken parameter combinations (rotation, skew,
scale, additive origin + local center, the clock-hand 14x200 case) and
verifies their TransformToVisual mappings. All assertions go through
public API so the same suite runs on Uno Skia, Uno mobile, Uno WASM,
and native WinUI as a parity check.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings April 30, 2026 12:03
@MartinZikmund MartinZikmund changed the title fix(uno-ui): Honour RenderTransformOrigin in CompositeTransform Honor RenderTransformOrigin in CompositeTransform Apr 30, 2026
@MartinZikmund
MartinZikmund enabled auto-merge April 30, 2026 12:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes backend-specific matrix generation for CompositeTransform so RenderTransformOrigin is honoured consistently across Scale/Skew/Rotate (matching WinUI behavior), and adds runtime tests to prevent regressions and validate parity.

Changes:

  • Fix CompositeTransform.ToMatrix(absoluteOrigin) to use the origin-adjusted combined center for Scale/Skew/Rotate (not just Scale).
  • Rename locals to avoid case-only collisions that could obscure regressions.
  • Add Given_CompositeTransform runtime tests covering origin + local center stacking and real-world scenarios (including the 14×200 “clock hand” repro).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Uno.UI/UI/Xaml/Media/CompositeTransform.cs Routes the combined center (absolute origin + local CenterX/Y) into Scale/Skew/Rotate matrix generation to match WinUI pivoting.
src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Media/Given_CompositeTransform.cs Adds runtime tests validating point mappings via TransformToVisual across key CompositeTransform + RenderTransformOrigin combinations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 210008 has failed on Uno.UI - CI.

@MartinZikmund
MartinZikmund merged commit 35cbc7a into unoplatform:master May 2, 2026
49 checks passed
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.

RenderTransformOrigin is ignored when combined with CompositeTransform on Skia

4 participants