diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-02-16 14:00:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-16 14:00:45 +0100 |
commit | 2a03886cbfadbb51e98d0238506d4a5e2be64ed2 (patch) | |
tree | 8c483ef315bf27da12915e0241a75b3ed5898cba /scene/resources | |
parent | bab06c9d06c8615775cbdd9499658c8b08fa0d38 (diff) | |
parent | ddf05a7c3c94852c2c214e00f5b97721b8349519 (diff) |
Merge pull request #46082 from YeldhamDev/styleboxline_margin_fix
Fix StyleBoxLine's incorrect style margin values
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/style_box.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index 8e47c1c15c..9b80224c3f 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -937,8 +937,17 @@ void StyleBoxLine::_bind_methods() { } float StyleBoxLine::get_style_margin(Side p_side) const { - ERR_FAIL_INDEX_V((int)p_side, 4, thickness); - return thickness; + ERR_FAIL_INDEX_V((int)p_side, 4, 0); + + if (vertical) { + if (p_side == SIDE_LEFT || p_side == SIDE_RIGHT) { + return thickness / 2.0; + } + } else if (p_side == SIDE_TOP || p_side == SIDE_BOTTOM) { + return thickness / 2.0; + } + + return 0; } Size2 StyleBoxLine::get_center_size() const { |