Fix StyleBoxLine's incorrect style margin values

(cherry picked from commit ddf05a7c3c)
This commit is contained in:
Michael Alexsander 2021-02-16 01:36:51 -03:00 committed by Rémi Verschelde
parent 6440b7fcae
commit c67c3e0a46
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 12 additions and 2 deletions

View File

@ -1041,9 +1041,19 @@ void StyleBoxLine::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "thickness", PROPERTY_HINT_RANGE, "0,10"), "set_thickness", "get_thickness");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "vertical"), "set_vertical", "is_vertical");
}
float StyleBoxLine::get_style_margin(Margin p_margin) const {
ERR_FAIL_INDEX_V((int)p_margin, 4, thickness);
return thickness;
ERR_FAIL_INDEX_V((int)p_margin, 4, 0);
if (vertical) {
if (p_margin == MARGIN_LEFT || p_margin == MARGIN_RIGHT) {
return thickness / 2.0;
}
} else if (p_margin == MARGIN_TOP || p_margin == MARGIN_BOTTOM) {
return thickness / 2.0;
}
return 0;
}
Size2 StyleBoxLine::get_center_size() const {
return Size2();