Merge pull request #46082 from YeldhamDev/styleboxline_margin_fix

Fix StyleBoxLine's incorrect style margin values
This commit is contained in:
Rémi Verschelde 2021-02-16 14:00:45 +01:00 committed by GitHub
commit 2a03886cbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {