@@ -93,7 +93,7 @@ void ScrollBar::gui_input(const Ref<InputEvent> &p_event) {
9393 return ;
9494 }
9595
96- ofs -= decr_size;
96+ ofs -= decr_size + theme_cache. scroll_style -> get_margin (orientation == VERTICAL ? SIDE_TOP : SIDE_LEFT) ;
9797
9898 if (ofs < grabber_ofs) {
9999 if (scrolling) {
@@ -151,7 +151,7 @@ void ScrollBar::gui_input(const Ref<InputEvent> &p_event) {
151151 Ref<Texture2D> decr = theme_cache.decrement_icon ;
152152
153153 double decr_size = orientation == VERTICAL ? decr->get_height () : decr->get_width ();
154- ofs -= decr_size;
154+ ofs -= decr_size + theme_cache. scroll_style -> get_margin (orientation == VERTICAL ? SIDE_TOP : SIDE_LEFT) ;
155155
156156 double diff = (ofs - drag.pos_at_click ) / get_area_size ();
157157
@@ -248,8 +248,6 @@ void ScrollBar::_notification(int p_what) {
248248 incr = theme_cache.increment_icon ;
249249 }
250250
251- Ref<StyleBox> bg = has_focus () ? theme_cache.scroll_focus_style : theme_cache.scroll_style ;
252-
253251 Ref<StyleBox> grabber;
254252 if (drag.active ) {
255253 grabber = theme_cache.grabber_pressed_style ;
@@ -277,7 +275,11 @@ void ScrollBar::_notification(int p_what) {
277275 area.height -= incr->get_height () + decr->get_height ();
278276 }
279277
280- bg->draw (ci, Rect2 (ofs, area));
278+ if (has_focus ()) {
279+ theme_cache.scroll_focus_style ->draw (ci, Rect2 (ofs, area));
280+ } else {
281+ theme_cache.scroll_style ->draw (ci, Rect2 (ofs, area));
282+ }
281283
282284 if (orientation == HORIZONTAL) {
283285 ofs.width += area.width ;
@@ -292,11 +294,11 @@ void ScrollBar::_notification(int p_what) {
292294 grabber_rect.size .width = get_grabber_size ();
293295 grabber_rect.size .height = get_size ().height ;
294296 grabber_rect.position .y = 0 ;
295- grabber_rect.position .x = get_grabber_offset () + decr->get_width () + bg ->get_margin (SIDE_LEFT);
297+ grabber_rect.position .x = get_grabber_offset () + decr->get_width () + theme_cache. scroll_style ->get_margin (SIDE_LEFT);
296298 } else {
297299 grabber_rect.size .width = get_size ().width ;
298300 grabber_rect.size .height = get_grabber_size ();
299- grabber_rect.position .y = get_grabber_offset () + decr->get_height () + bg ->get_margin (SIDE_TOP);
301+ grabber_rect.position .y = get_grabber_offset () + decr->get_height () + theme_cache. scroll_style ->get_margin (SIDE_TOP);
300302 grabber_rect.position .x = 0 ;
301303 }
302304
0 commit comments