Skip to content
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

Simplify Control internal transform calculation #84840

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions scene/gui/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -682,12 +682,10 @@ Size2 Control::get_parent_area_size() const {
// Positioning and sizing.

Transform2D Control::_get_internal_transform() const {
Transform2D rot_scale;
rot_scale.set_rotation_and_scale(data.rotation, data.scale);
Transform2D offset;
offset.set_origin(-data.pivot_offset);

return offset.affine_inverse() * (rot_scale * offset);
// T(pivot_offset) * R(rotation) * S(scale) * T(-pivot_offset)
Transform2D xform(data.rotation, data.scale, 0.0f, data.pivot_offset);
xform.translate_local(-data.pivot_offset);
return xform;
}

void Control::_update_canvas_item_transform() {
Expand Down
Loading