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

Code before:
			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)));

				if (ticks > 1) {
					int grabber_offset = (grabber->get_height() / 2 - tick->get_height() / 2);
					for (int i = 0; i < ticks; i++) {
						if (!ticks_on_borders && (i == 0 || i + 1 == ticks)) {
							continue;
						}
						int ofs = (i * areasize / (ticks - 1)) + grabber_offset - grabber_shift;
						tick->draw(ci, Point2i((size.width - widget_width) / 2, ofs));
					}
				}
				grabber->draw(ci, Point2i(size.width / 2 - grabber->get_width() / 2 + theme_cache.grabber_offset, size.height - ratio * areasize - grabber->get_height() + grabber_shift));
			} else {
				int widget_height = style->get_minimum_size().height;
				double areasize = size.width - (theme_cache.center_grabber ? 0 : grabber->get_size().width);
				int grabber_shift = theme_cache.center_grabber ? -grabber->get_width() / 2 : 0;

				style->draw(ci, Rect2i(Point2i(0, (size.height - widget_height) / 2), Size2i(size.width, widget_height)));
				grabber_area->draw(ci, Rect2i(Point2i(0, (size.height - widget_height) / 2), Size2i(areasize * ratio + grabber->get_width() / 2 + grabber_shift, widget_height)));

Review comment (suggestion):
```suggestion
				} else if (orientation == VERTICAL) {
```

Code after:

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()));
					}
				}
			}

		} break;

		case NOTIFICATION_THEME_CHANGED: {
			update_minimum_size();
			queue_redraw();
		} break;

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

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