Skip to content

Commit

Permalink
Merge pull request #70864 from timothyqiu/scroll-margin
Browse files Browse the repository at this point in the history
Fix scroll grabber can't reach ends in default theme
  • Loading branch information
akien-mga committed Jan 3, 2023
2 parents c527942 + e57cdab commit 1d92b44
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scene/resources/default_theme/default_theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,14 +509,15 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const

Ref<Texture2D> empty_icon = memnew(ImageTexture);

const Ref<StyleBoxFlat> style_scrollbar = make_flat_stylebox(style_normal_color, 4, 4, 4, 4, 10);
const Ref<StyleBoxFlat> style_h_scrollbar = make_flat_stylebox(style_normal_color, 0, 4, 0, 4, 10);
const Ref<StyleBoxFlat> style_v_scrollbar = make_flat_stylebox(style_normal_color, 4, 0, 4, 0, 10);
Ref<StyleBoxFlat> style_scrollbar_grabber = make_flat_stylebox(style_progress_color, 4, 4, 4, 4, 10);
Ref<StyleBoxFlat> style_scrollbar_grabber_highlight = make_flat_stylebox(style_focus_color, 4, 4, 4, 4, 10);
Ref<StyleBoxFlat> style_scrollbar_grabber_pressed = make_flat_stylebox(style_focus_color * Color(0.75, 0.75, 0.75), 4, 4, 4, 4, 10);

// HScrollBar

theme->set_stylebox("scroll", "HScrollBar", style_scrollbar);
theme->set_stylebox("scroll", "HScrollBar", style_h_scrollbar);
theme->set_stylebox("scroll_focus", "HScrollBar", focus);
theme->set_stylebox("grabber", "HScrollBar", style_scrollbar_grabber);
theme->set_stylebox("grabber_highlight", "HScrollBar", style_scrollbar_grabber_highlight);
Expand All @@ -531,7 +532,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const

// VScrollBar

theme->set_stylebox("scroll", "VScrollBar", style_scrollbar);
theme->set_stylebox("scroll", "VScrollBar", style_v_scrollbar);
theme->set_stylebox("scroll_focus", "VScrollBar", focus);
theme->set_stylebox("grabber", "VScrollBar", style_scrollbar_grabber);
theme->set_stylebox("grabber_highlight", "VScrollBar", style_scrollbar_grabber_highlight);
Expand Down

0 comments on commit 1d92b44

Please sign in to comment.