Remove size restrictions from StyleBoxTexture
This commit is contained in:
parent
cc7aa72f01
commit
9b7124b49c
|
@ -198,7 +198,7 @@ static Ref<StyleBoxTexture> make_stylebox(Ref<Texture2D> p_texture, float p_left
|
|||
Ref<StyleBoxTexture> style(memnew(StyleBoxTexture));
|
||||
style->set_texture(p_texture);
|
||||
style->set_texture_margin_individual(p_left * EDSCALE, p_top * EDSCALE, p_right * EDSCALE, p_bottom * EDSCALE);
|
||||
style->set_content_margin_individual(p_margin_left * EDSCALE, p_margin_top * EDSCALE, p_margin_right * EDSCALE, p_margin_bottom * EDSCALE);
|
||||
style->set_content_margin_individual((p_left + p_margin_left) * EDSCALE, (p_top + p_margin_top) * EDSCALE, (p_right + p_margin_right) * EDSCALE, (p_bottom + p_margin_bottom) * EDSCALE);
|
||||
style->set_draw_center(p_draw_center);
|
||||
return style;
|
||||
}
|
||||
|
@ -1492,11 +1492,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
|||
// HScrollBar
|
||||
Ref<Texture2D> empty_icon = memnew(ImageTexture);
|
||||
|
||||
theme->set_stylebox("scroll", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 0, 0, 0, 0));
|
||||
theme->set_stylebox("scroll_focus", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 0, 0, 0, 0));
|
||||
theme->set_stylebox("grabber", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabber"), SNAME("EditorIcons")), 6, 6, 6, 6, 2, 2, 2, 2));
|
||||
theme->set_stylebox("grabber_highlight", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberHl"), SNAME("EditorIcons")), 5, 5, 5, 5, 2, 2, 2, 2));
|
||||
theme->set_stylebox("grabber_pressed", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberPressed"), SNAME("EditorIcons")), 6, 6, 6, 6, 2, 2, 2, 2));
|
||||
theme->set_stylebox("scroll", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 1, 1, 1, 1));
|
||||
theme->set_stylebox("scroll_focus", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 1, 1, 1, 1));
|
||||
theme->set_stylebox("grabber", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabber"), SNAME("EditorIcons")), 6, 6, 6, 6, 1, 1, 1, 1));
|
||||
theme->set_stylebox("grabber_highlight", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberHl"), SNAME("EditorIcons")), 5, 5, 5, 5, 1, 1, 1, 1));
|
||||
theme->set_stylebox("grabber_pressed", "HScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberPressed"), SNAME("EditorIcons")), 6, 6, 6, 6, 1, 1, 1, 1));
|
||||
|
||||
theme->set_icon("increment", "HScrollBar", empty_icon);
|
||||
theme->set_icon("increment_highlight", "HScrollBar", empty_icon);
|
||||
|
@ -1506,11 +1506,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
|||
theme->set_icon("decrement_pressed", "HScrollBar", empty_icon);
|
||||
|
||||
// VScrollBar
|
||||
theme->set_stylebox("scroll", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 0, 0, 0, 0));
|
||||
theme->set_stylebox("scroll_focus", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 0, 0, 0, 0));
|
||||
theme->set_stylebox("grabber", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabber"), SNAME("EditorIcons")), 6, 6, 6, 6, 2, 2, 2, 2));
|
||||
theme->set_stylebox("grabber_highlight", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberHl"), SNAME("EditorIcons")), 5, 5, 5, 5, 2, 2, 2, 2));
|
||||
theme->set_stylebox("grabber_pressed", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberPressed"), SNAME("EditorIcons")), 6, 6, 6, 6, 2, 2, 2, 2));
|
||||
theme->set_stylebox("scroll", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 1, 1, 1, 1));
|
||||
theme->set_stylebox("scroll_focus", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollBg"), SNAME("EditorIcons")), 5, 5, 5, 5, 1, 1, 1, 1));
|
||||
theme->set_stylebox("grabber", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabber"), SNAME("EditorIcons")), 6, 6, 6, 6, 1, 1, 1, 1));
|
||||
theme->set_stylebox("grabber_highlight", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberHl"), SNAME("EditorIcons")), 5, 5, 5, 5, 1, 1, 1, 1));
|
||||
theme->set_stylebox("grabber_pressed", "VScrollBar", make_stylebox(theme->get_icon(SNAME("GuiScrollGrabberPressed"), SNAME("EditorIcons")), 6, 6, 6, 6, 1, 1, 1, 1));
|
||||
|
||||
theme->set_icon("increment", "VScrollBar", empty_icon);
|
||||
theme->set_icon("increment_highlight", "VScrollBar", empty_icon);
|
||||
|
|
|
@ -231,22 +231,6 @@ bool StyleBoxTexture::is_draw_center_enabled() const {
|
|||
return draw_center;
|
||||
}
|
||||
|
||||
Size2 StyleBoxTexture::get_minimum_size() const {
|
||||
Size2 min_size = StyleBox::get_minimum_size();
|
||||
|
||||
// Make sure that the min size is no smaller than the used texture region.
|
||||
if (texture.is_valid()) {
|
||||
if (min_size.x < region_rect.size.x) {
|
||||
min_size.x = region_rect.size.x;
|
||||
}
|
||||
if (min_size.y < region_rect.size.y) {
|
||||
min_size.y = region_rect.size.y;
|
||||
}
|
||||
}
|
||||
|
||||
return min_size;
|
||||
}
|
||||
|
||||
void StyleBoxTexture::set_expand_margin(Side p_side, float p_size) {
|
||||
ERR_FAIL_INDEX((int)p_side, 4);
|
||||
expand_margin[p_side] = p_size;
|
||||
|
|
|
@ -107,8 +107,6 @@ protected:
|
|||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
virtual Size2 get_minimum_size() const override;
|
||||
|
||||
void set_expand_margin(Side p_expand_side, float p_size);
|
||||
void set_expand_margin_all(float p_expand_margin_size);
|
||||
void set_expand_margin_individual(float p_left, float p_top, float p_right, float p_bottom);
|
||||
|
|
Loading…
Reference in New Issue