[PR #1931] [MERGED] Game Rules and Statistics: the scroll bars can be dragged #3873

Closed
opened 2026-11-03 04:12:55 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1931
Author: @levzzz5154
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: fix/draggable-scrollbars


📝 Commits (3)

  • 61c5f29 Game Rules and Statistics: the scroll bars can be dragged
  • dd73fac Merge origin/main into fix/draggable-scrollbars
  • a413812 Scroll bars: the screen's GUI size, and a test of the drag

📊 Changes

4 files changed (+147 additions, -23 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+10 -0)
📝 crates/horizon-client/src/game/game_rules_screen.rs (+65 -14)
📝 crates/horizon-client/src/game/lan_screen.rs (+21 -0)
📝 crates/horizon-client/src/game/stats_screen.rs (+51 -9)

📄 Description

🤖 Opened by levzzz5154's AI agent ([CC], deepseek-v4.1-flash), not by levzzz5154.

What and why

Fixes #1782.

The Game Rules list (World Options → Edit Game Rules) and the Statistics list drew a scroll bar but only
listened to the mouse wheel: a press inside the bar column, the pointer moving while it is held, and the release
were dropped, so the bar could not be dragged.

ui::Scroll already models exactly this — AbstractScrollArea's updateScrolling (press inside the column
holds it), mouseDragged (above/below the list jumps to an end, otherwise the thumb follows the pointer) and
onRelease; the server list uses it. Both screens now keep their scrolling in a ui::Scroll instead of a bare
f32, and:

  • RulesScreen::press_scrollbar/drag/release, called from its click (a press on the bar holds it and
    clicks nothing else) and from the window's CursorMoved/MouseInput through
    world_options_drag/world_options_release.
  • Game::stats_press_scrollbar/stats_drag/stats_release, likewise from stats_click and the window.

The wheel keeps its own rate (half an entry a step in the rules, half a row in the statistics), and the bar
column is the one the drawing already used (left + ROW_WIDTH + 6 + 2, left + 280 + 6).

Verification

In the game (horizon-ctl launch … --offscreen, then click-at/drag-at on the bar column of both screens):
the rules list's scroll follows the pointer and stops at both ends, and the statistics list does the same on each
tab.

Scope

4 files, +132 −23: the two screens, the world options screen and the window's event routing.

🤖 Generated with [CC].

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on cachyos-x8664, against upstream/main at 7fd1f3118, 2 min 3 s)

Check Result
Scope ✅ 4 files, +132 −23
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (5 s)
clippy ❌ failed (8 s)
tests: horizon-client ✅ 1242 passed (1 min 47 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 255 affected, to run in CI (--quick)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

clippy fails on crates/horizon-client/src/mobs/axolotl.rs:169 (overly_complex_bool_expr), which fails the same way on upstream/main at 7fd1f3118: nothing in this branch touches it.

🤖 Generated with [CC].


🔄 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/1931 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/draggable-scrollbars` --- ### 📝 Commits (3) - [`61c5f29`](https://github.com/horizon-rust/horizon/commit/61c5f29ab772d04d4cf55c06f59870c27205c16b) Game Rules and Statistics: the scroll bars can be dragged - [`dd73fac`](https://github.com/horizon-rust/horizon/commit/dd73faccbc9fdaa81f13c5db31ca5156b4a38b4d) Merge origin/main into fix/draggable-scrollbars - [`a413812`](https://github.com/horizon-rust/horizon/commit/a41381236362cca38a951ed652adeaef876e0b4a) Scroll bars: the screen's GUI size, and a test of the drag ### 📊 Changes **4 files changed** (+147 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+10 -0) 📝 `crates/horizon-client/src/game/game_rules_screen.rs` (+65 -14) 📝 `crates/horizon-client/src/game/lan_screen.rs` (+21 -0) 📝 `crates/horizon-client/src/game/stats_screen.rs` (+51 -9) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent ([CC], deepseek-v4.1-flash), not by levzzz5154. ## What and why Fixes #1782. The Game Rules list (World Options → Edit Game Rules) and the Statistics list drew a scroll bar but only listened to the mouse wheel: a press inside the bar column, the pointer moving while it is held, and the release were dropped, so the bar could not be dragged. `ui::Scroll` already models exactly this — `AbstractScrollArea`'s `updateScrolling` (press inside the column holds it), `mouseDragged` (above/below the list jumps to an end, otherwise the thumb follows the pointer) and `onRelease`; the server list uses it. Both screens now keep their scrolling in a `ui::Scroll` instead of a bare `f32`, and: - `RulesScreen::press_scrollbar`/`drag`/`release`, called from its `click` (a press on the bar holds it and clicks nothing else) and from the window's `CursorMoved`/`MouseInput` through `world_options_drag`/`world_options_release`. - `Game::stats_press_scrollbar`/`stats_drag`/`stats_release`, likewise from `stats_click` and the window. The wheel keeps its own rate (half an entry a step in the rules, half a row in the statistics), and the bar column is the one the drawing already used (`left + ROW_WIDTH + 6 + 2`, `left + 280 + 6`). ## Verification In the game (`horizon-ctl launch … --offscreen`, then `click-at`/`drag-at` on the bar column of both screens): the rules list's scroll follows the pointer and stops at both ends, and the statistics list does the same on each tab. ## Scope 4 files, +132 −23: the two screens, the world options screen and the window's event routing. 🤖 Generated with [[CC]](https://github.com/levzzz5154/horizon). ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on cachyos-x8664, against upstream/main at 7fd1f3118, 2 min 3 s) | Check | Result | | --- | --- | | Scope | ✅ 4 files, +132 −23 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (5 s) | | clippy | ❌ failed (8 s) | | tests: horizon-client | ✅ 1242 passed (1 min 47 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 255 affected, to run in CI (--quick) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | `clippy` fails on `crates/horizon-client/src/mobs/axolotl.rs:169` (`overly_complex_bool_expr`), which fails the same way on `upstream/main` at 7fd1f3118: nothing in this branch touches it. 🤖 Generated with [[CC]](https://github.com/levzzz5154/horizon). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:12:55 +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#3873
No description provided.