Skip to content

Commit 21b1530

Browse files
committed
Fix incorrect anchor preset when custom offset is set
1 parent 4d1f26e commit 21b1530

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

scene/gui/control.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,10 @@ int Control::_get_anchors_layout_preset() const {
10431043
float top = get_anchor(SIDE_TOP);
10441044
float bottom = get_anchor(SIDE_BOTTOM);
10451045

1046+
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) {
1047+
return -1;
1048+
}
1049+
10461050
if (left == (float)ANCHOR_BEGIN && right == (float)ANCHOR_BEGIN && top == (float)ANCHOR_BEGIN && bottom == (float)ANCHOR_BEGIN) {
10471051
return (int)LayoutPreset::PRESET_TOP_LEFT;
10481052
}

0 commit comments

Comments
 (0)