Repository: godotengine/godot
File: scene/gui/slider.cpp (C++)

Code before:
		} break;

		case NOTIFICATION_MOUSE_ENTER: {
			mouse_inside = true;
			queue_redraw();
		} break;

		case NOTIFICATION_MOUSE_EXIT: {
			mouse_inside = false;
			queue_redraw();
		} break;

		case NOTIFICATION_VISIBILITY_CHANGED:
		case NOTIFICATION_EXIT_TREE: {
			mouse_inside = false;
			grab.active = false;
		} break;

		case NOTIFICATION_DRAW: {
			RID ci = get_canvas_item();
			Size2i size = get_size();
			double ratio = Math::is_nan(get_as_ratio()) ? 0 : get_as_ratio();

			Ref<StyleBox> style = theme_cache.slider_style;
			Ref<Texture2D> tick = theme_cache.tick_icon;

			bool highlighted = mouse_inside || has_focus();
			Ref<Texture2D> grabber;
			if (editable) {
				if (highlighted) {
					grabber = theme_cache.grabber_hl_icon;
				} else {
					grabber = theme_cache.grabber_icon;
				}
			} else {
				grabber = theme_cache.grabber_disabled_icon;
			}

			Ref<StyleBox> grabber_area;
			if (highlighted) {
				grabber_area = theme_cache.grabber_area_hl_style;
			} else {
				grabber_area = theme_cache.grabber_area_style;
			}

			if (orientation == VERTICAL) {
				int widget_width = style->get_minimum_size().width;
				double areasize = size.height - (theme_cache.center_grabber ? 0 : grabber->get_height());
				int grabber_shift = theme_cache.center_grabber ? grabber->get_height() / 2 : 0;
				style->draw(ci, Rect2i(Point2i(size.width / 2 - widget_width / 2, 0), Size2i(widget_width, size.height)));
				grabber_area->draw(ci, Rect2i(Point2i((size.width - widget_width) / 2, size.height - areasize * ratio - grabber->get_height() / 2 + grabber_shift), Size2i(widget_width, areasize * ratio + grabber->get_height() / 2 - grabber_shift)));

Review comment (suggestion):
Same problem as in https://github.com/godotengine/godot/pull/63168#discussion_r1170564401, but I guess it's a bit more complicated to handle. You could leave it like that though.

Code after:
		} else if (p_event->is_action("ui_end", true) && p_event->is_pressed()) {
			set_value(get_max());
			accept_event();
		}
	}
}

void Slider::_update_theme_item_cache() {
	Range::_update_theme_item_cache();

	theme_cache.slider_style = get_theme_stylebox(SNAME("slider"));
	theme_cache.grabber_area_style = get_theme_stylebox(SNAME("grabber_area"));
	theme_cache.grabber_area_hl_style = get_theme_stylebox(SNAME("grabber_area_highlight"));

	theme_cache.grabber_icon = get_theme_icon(SNAME("grabber"));
	theme_cache.grabber_hl_icon = get_theme_icon(SNAME("grabber_highlight"));
	theme_cache.grabber_disabled_icon = get_theme_icon(SNAME("grabber_disabled"));
	theme_cache.tick_icon = get_theme_icon(SNAME("tick"));
}

void Slider::_notification(int p_what) {
	switch (p_what) {
		case NOTIFICATION_INTERNAL_PROCESS: {
			Input *input = Input::get_singleton();

			if (input->is_action_just_released("ui_left") || input->is_action_just_released("ui_right") || input->is_action_just_released("ui_up") || input->is_action_just_released("ui_down")) {
				gamepad_event_delay_ms = DEFAULT_GAMEPAD_EVENT_DELAY_MS;
				set_process_internal(false);
				return;
			}

			gamepad_event_delay_ms -= get_process_delta_time();
			if (gamepad_event_delay_ms <= 0) {
				gamepad_event_delay_ms = GAMEPAD_EVENT_REPEAT_RATE_MS + gamepad_event_delay_ms;
				if (orientation == HORIZONTAL) {
					if (input->is_action_pressed("ui_left")) {
						set_value(get_value() - (custom_step >= 0 ? custom_step : get_step()));
					}

					if (input->is_action_pressed("ui_right")) {
						set_value(get_value() + (custom_step >= 0 ? custom_step : get_step()));
					}
				} else if (orientation == VERTICAL) {
					if (input->is_action_pressed("ui_down")) {
						set_value(get_value() - (custom_step >= 0 ? custom_step : get_step()));
					}

					if (input->is_action_pressed("ui_up")) {
						set_value(get_value() + (custom_step >= 0 ? custom_step : get_step()));
					}
				}