1
0
mirror of https://github.com/godotengine/godot.git synced 2026-01-04 19:21:46 +00:00

Fix incorrect anchor preset when custom offset is set

This commit is contained in:
limuy
2025-07-09 23:02:07 +08:00
parent 4d1f26e1fd
commit 21b1530cd4

View File

@@ -1043,6 +1043,10 @@ int Control::_get_anchors_layout_preset() const {
float top = get_anchor(SIDE_TOP);
float bottom = get_anchor(SIDE_BOTTOM);
if (get_offset(SIDE_LEFT) != 0.0 || get_offset(SIDE_RIGHT) != 0.0 || get_offset(SIDE_TOP) != 0.0 || get_offset(SIDE_BOTTOM) != 0.0) {
return -1;
}
if (left == (float)ANCHOR_BEGIN && right == (float)ANCHOR_BEGIN && top == (float)ANCHOR_BEGIN && bottom == (float)ANCHOR_BEGIN) {
return (int)LayoutPreset::PRESET_TOP_LEFT;
}