Elevate Control.get_rect
to CanvasItem.get_rect
#10941
Closed
HubbleCommand
started this conversation in
2D
Replies: 1 comment 3 replies
-
Not every |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As the title says, I'd like to open the discussion to elevating the
get_rect
function ofControl
toCanvasItem
, so that nodes inheriting fromNode2D
could implement it as well.Some Node2Ds like Sprite2D do have a public method for it, and other nodes like
Polygon2D
andLine2D
keep this information internally for editor use.While in many cases it can be better to work with the Physics server, that can also be excessive. For example, I wanted to get the Rect of a Polygon2D for some basic overlap checks. Would have been overkill to create the resource in the physics server etc. just for a rare check. While it is very easy to determine the Rect in many cases, it would be nice to have it directly from the engine. Even the example for Sprite2D to just determine clicks seems like a handy enough reason to me, albeit not particularly important.
I'm also interested in the reason
get_rect
wasn't made available inNode2D
, if any. I looked through some discussions, issues, and PRs, and didn't find anything.This is something I would be willing to work on if it's desired.
Beta Was this translation helpful? Give feedback.
All reactions