[PR #3640] [MERGED] Graphics settings: the scrollbar can be held and dragged #5114

Closed
opened 2026-11-03 05:10:20 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3640
Author: @d3grando
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix-3552


📝 Commits (2)

  • 8469dcc Graphics settings: the scrollbar can be held and dragged
  • ec86a34 Merge main into fix-3552

📊 Changes

1 file changed (+75 additions, -17 deletions)

View changed files

📝 crates/horizon-client-render/src/graphics_ui.rs (+75 -17)

📄 Description

🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves.

Fixes #3552

What and why

On Options > Horizon Settings > Graphics (Simple and Advanced), the scrollbar is drawn but can't be grabbed. The only way to move through the list was the mouse wheel.

Root cause. GraphicsUi (graphics_ui.rs) kept its scroll as a bare f32. GraphicsUi::click never checked whether the press was on the scrollbar, and on a drag it only moved a held slider. The other options pages hold their scrollbar in options_ui.rs, but the graphics pages return before that code runs (OptionsUi::click sends them to GraphicsUi first). So the scrollbar there was only ever drawn.

Fix. GraphicsUi now keeps its scroll in ui::Scroll, the AbstractScrollArea port that Game Rules, Statistics, dialogs and mod lists already use:

  • A press on the scrollbar column holds it, without a click sound and without changing any setting.
  • A drag moves the list with the pointer. Going above or below the list jumps to the first or last row.
  • release lets go of the scrollbar as well as a slider. A slider still plays its click on release; the scrollbar plays none.
  • The scrollbar's column is computed once (GraphicsUi::scrollbar_x), so drawing and input use the same x.

The wheel goes through Scroll::wheel with the same 18 px step as before. The existing scroll tests pass unchanged, except they now read scroll.amount.

Vanilla reference

net.minecraft.client.gui.components.AbstractScrollArea: updateScrolling (a press over scrollBarX() holds the bar), mouseDragged (the amount moves by dragY * max(1, maxScrollAmount / (height - scrollerHeight())); above or below the area it jumps to an end), onRelease. All three are already ported as ui::Scroll::{press, drag, release}. The graphics pages themselves are Horizon-only.

Test

New test graphics_ui::tests::the_scrollbar_can_be_held_and_dragged. It presses on the scrollbar column and drags down: the list scrolls. It drags past the bottom (last row) and above the top (first row). Then it releases and checks that a further drag does nothing and that no slider click plays.

Before (only the test added, the code as on main):

test graphics_ui::tests::the_scrollbar_can_be_held_and_dragged ... FAILED
thread 'graphics_ui::tests::the_scrollbar_can_be_held_and_dragged' panicked at crates\horizon-client-render\src\graphics_ui.rs:963:9:
dragging down scrolls the list down
test result: FAILED. 9 passed; 1 failed; 0 ignored; 0 measured; 502 filtered out

After:

test graphics_ui::tests::the_scrollbar_can_be_held_and_dragged ... ok
test graphics_ui::tests::scrolling_stops_at_both_limits_before_layout ... ok
test graphics_ui::tests::resizing_clamps_before_positioning_graphics_rows ... ok
test graphics_ui::tests::graphics_buttons_sound_on_press_and_sliders_on_release ... ok
test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 502 filtered out

In game (Windows 11, Vulkan, 1280×720, GUI scale 3)

I opened horizon-ctl options graphics-advanced and dragged the scrollbar with horizon-ctl drag-at 423 50 … 423 200, the column on the right edge of the list.

  • Before (main build): the list didn't move. The first row (LOD Distance) stayed at GUI y 53 after the drag.
  • After: dragging the thumb 50 px down scrolled to Fog / Weather / Animated Textures / Display. Dragging past the bottom showed the last rows (Battery Mode, Worker Threads, Graphics API). Dragging above the list went back to LOD Distance at y 53. No setting changed.

Self-check

tools/pr_ready.py doesn't run on Windows, so I ran its steps by hand:

cargo fmt --all -- --check
cargo clippy -p horizon-client-render --all-targets -- -D warnings
cargo test -p horizon-client-render --lib -- graphics_ui::tests
cargo build --profile fast -p horizon-client --features mods --bins

All pass.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/3640 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix-3552` --- ### 📝 Commits (2) - [`8469dcc`](https://github.com/horizon-rust/horizon/commit/8469dcc9530870c72c0d033e5ea9a218381f5ba0) Graphics settings: the scrollbar can be held and dragged - [`ec86a34`](https://github.com/horizon-rust/horizon/commit/ec86a343c5d568d597623ef5545cc811aaec3e0f) Merge main into fix-3552 ### 📊 Changes **1 file changed** (+75 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/graphics_ui.rs` (+75 -17) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves. Fixes #3552 ## What and why On Options > Horizon Settings > Graphics (Simple and Advanced), the scrollbar is drawn but can't be grabbed. The only way to move through the list was the mouse wheel. **Root cause.** `GraphicsUi` (`graphics_ui.rs`) kept its scroll as a bare `f32`. `GraphicsUi::click` never checked whether the press was on the scrollbar, and on a drag it only moved a held slider. The other options pages hold their scrollbar in `options_ui.rs`, but the graphics pages return before that code runs (`OptionsUi::click` sends them to `GraphicsUi` first). So the scrollbar there was only ever drawn. **Fix.** `GraphicsUi` now keeps its scroll in `ui::Scroll`, the `AbstractScrollArea` port that Game Rules, Statistics, dialogs and mod lists already use: - A press on the scrollbar column holds it, without a click sound and without changing any setting. - A drag moves the list with the pointer. Going above or below the list jumps to the first or last row. - `release` lets go of the scrollbar as well as a slider. A slider still plays its click on release; the scrollbar plays none. - The scrollbar's column is computed once (`GraphicsUi::scrollbar_x`), so drawing and input use the same x. The wheel goes through `Scroll::wheel` with the same 18 px step as before. The existing scroll tests pass unchanged, except they now read `scroll.amount`. ## Vanilla reference `net.minecraft.client.gui.components.AbstractScrollArea`: `updateScrolling` (a press over `scrollBarX()` holds the bar), `mouseDragged` (the amount moves by `dragY * max(1, maxScrollAmount / (height - scrollerHeight()))`; above or below the area it jumps to an end), `onRelease`. All three are already ported as `ui::Scroll::{press, drag, release}`. The graphics pages themselves are Horizon-only. ## Test New test `graphics_ui::tests::the_scrollbar_can_be_held_and_dragged`. It presses on the scrollbar column and drags down: the list scrolls. It drags past the bottom (last row) and above the top (first row). Then it releases and checks that a further drag does nothing and that no slider click plays. Before (only the test added, the code as on `main`): ``` test graphics_ui::tests::the_scrollbar_can_be_held_and_dragged ... FAILED thread 'graphics_ui::tests::the_scrollbar_can_be_held_and_dragged' panicked at crates\horizon-client-render\src\graphics_ui.rs:963:9: dragging down scrolls the list down test result: FAILED. 9 passed; 1 failed; 0 ignored; 0 measured; 502 filtered out ``` After: ``` test graphics_ui::tests::the_scrollbar_can_be_held_and_dragged ... ok test graphics_ui::tests::scrolling_stops_at_both_limits_before_layout ... ok test graphics_ui::tests::resizing_clamps_before_positioning_graphics_rows ... ok test graphics_ui::tests::graphics_buttons_sound_on_press_and_sliders_on_release ... ok test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 502 filtered out ``` ## In game (Windows 11, Vulkan, 1280×720, GUI scale 3) I opened `horizon-ctl options graphics-advanced` and dragged the scrollbar with `horizon-ctl drag-at 423 50 … 423 200`, the column on the right edge of the list. - **Before** (`main` build): the list didn't move. The first row (`LOD Distance`) stayed at GUI y 53 after the drag. - **After**: dragging the thumb 50 px down scrolled to Fog / Weather / Animated Textures / Display. Dragging past the bottom showed the last rows (Battery Mode, Worker Threads, Graphics API). Dragging above the list went back to `LOD Distance` at y 53. No setting changed. ## Self-check `tools/pr_ready.py` doesn't run on Windows, so I ran its steps by hand: ``` cargo fmt --all -- --check cargo clippy -p horizon-client-render --all-targets -- -D warnings cargo test -p horizon-client-render --lib -- graphics_ui::tests cargo build --profile fast -p horizon-client --features mods --bins ``` All pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:10:20 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#5114
No description provided.