X Tutup
Skip to content

Add helper methods to convert right-to-left Rect2i and Point2i in Tree's draw_item#110055

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
dagarsar:tree-rtl
Oct 1, 2025
Merged

Add helper methods to convert right-to-left Rect2i and Point2i in Tree's draw_item#110055
Repiteo merged 1 commit intogodotengine:masterfrom
dagarsar:tree-rtl

Conversation

@dagarsar
Copy link
Contributor

A small simplification. I've also removed calls to is_layout_rtl inside draw_item, since there is an rtl flag in the beginning of the method.

@dagarsar dagarsar requested a review from a team as a code owner August 28, 2025 14:13
@Calinou Calinou added this to the 4.x milestone Aug 28, 2025
@KoBeWi
Copy link
Member

KoBeWi commented Sep 18, 2025

Looks fine, but I wonder if it wouldn't be better to pass the Vector2/Rect2 as reference and modify it inside the function, instead of returning new one 🤔
In many cases you create a new rect when there wasn't one. Then again, it's super cheap, so maybe it's not a concern, idk.

@dagarsar
Copy link
Contributor Author

Looks fine, but I wonder if it wouldn't be better to pass the Vector2/Rect2 as reference and modify it inside the function, instead of returning new one 🤔 In many cases you create a new rect when there wasn't one. Then again, it's super cheap, so maybe it's not a concern, idk.

It would make code even simpler imo, I can make that change

@dagarsar
Copy link
Contributor Author

It would make code even simpler imo, I can make that change

Actually, I don't think this should be done. There are a few instances of both methods being used where the output is assigned to another variable and the input is used later, so these methods should not modify the input.

@KoBeWi KoBeWi modified the milestones: 4.x, 4.6 Oct 1, 2025
@Repiteo Repiteo merged commit 6b9acd7 into godotengine:master Oct 1, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Oct 1, 2025

Thanks!

@dagarsar dagarsar deleted the tree-rtl branch October 2, 2025 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

X Tutup