MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / expand_to

Method expand_to

modules/gui/gui/src/backend/text_server/rect2.h:54–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52 }
53
54 inline void expand_to(const Vector2& p_vector)
55 { // In place function for speed.
56#ifdef MATH_CHECKS
57 if (unlikely(size.x < 0 || size.y < 0))
58 {
59 ERR_PRINT("Rect2 size is negative, this is not supported. Use Rect2.abs() to get a Rect2 with a positive size.");
60 }
61#endif
62 Vector2 begin = position;
63 Vector2 end = position + size;
64
65 if (p_vector.x < begin.x)
66 {
67 begin.x = p_vector.x;
68 }
69 if (p_vector.y < begin.y)
70 {
71 begin.y = p_vector.y;
72 }
73
74 if (p_vector.x > end.x)
75 {
76 end.x = p_vector.x;
77 }
78 if (p_vector.y > end.y)
79 {
80 end.y = p_vector.y;
81 }
82
83 position = begin;
84 size = end - begin;
85 }
86};
87} // namespace godot

Callers 2

xformMethod · 0.80
xform_invMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected