[PR #6239] [MERGED] Scroll the merchant's offers by the wheel delta, not its sign #6737

Closed
opened 2026-11-03 06:25:56 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6239
Author: @MSedgeMC
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/merchant-scroll


📝 Commits (1)

  • 8801bf4 Scroll the merchant's offers by the wheel delta, not its sign

📊 Changes

1 file changed (+21 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/trading.rs (+21 -1)

📄 Description

MerchantScreen.mouseScrolled:

// javap -p -c on MerchantScreen
48: getfield  scrollOff
51: i2d
52: dload 7            // scrollY
54: dsub
55: d2i               // truncated after the subtraction
56: iconst_0
57: iload 10           // offers.size() - 7
59: invokestatic Mth.clamp:(III)I
62: putfield  scrollOff

Horizon passed d.signum() into the clamp, so every scroll event moved exactly one row
however large its delta was. A trackpad event (PixelDelta / 30) or a fast wheel burst
carrying 2.5 units moves two rows in vanilla and moved one in Horizon.

Proven: on the build VM, cargo test -q -p horizon-client --bin horizon-client game::trading::tests
→ 3 passed, including the_offers_scroll_by_the_wheel_delta (one notch, a fractional
delta, a two-and-a-half notch event, and both clamps). Compile-checked with
cargo check -p horizon-client --lib --bins.

Not proven: not checked in game.

One correction worth stating: the ledger note for this row claimed a wheel sensitivity of
0.25 would stop the list moving. That is not what vanilla does — the truncation happens
after the subtraction, so 3 - 0.25 still truncates to 2 and the list moves one row. The
real difference is only in deltas above one unit, and the test pins the true behaviour rather
than that claim.


🔄 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/6239 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/merchant-scroll` --- ### 📝 Commits (1) - [`8801bf4`](https://github.com/horizon-rust/horizon/commit/8801bf499159fa9acfc4bcefbc2b4dff157a8190) Scroll the merchant's offers by the wheel delta, not its sign ### 📊 Changes **1 file changed** (+21 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/trading.rs` (+21 -1) </details> ### 📄 Description `MerchantScreen.mouseScrolled`: ```java // javap -p -c on MerchantScreen 48: getfield scrollOff 51: i2d 52: dload 7 // scrollY 54: dsub 55: d2i // truncated after the subtraction 56: iconst_0 57: iload 10 // offers.size() - 7 59: invokestatic Mth.clamp:(III)I 62: putfield scrollOff ``` Horizon passed `d.signum()` into the clamp, so every scroll event moved exactly one row however large its delta was. A trackpad event (`PixelDelta / 30`) or a fast wheel burst carrying 2.5 units moves two rows in vanilla and moved one in Horizon. **Proven:** on the build VM, `cargo test -q -p horizon-client --bin horizon-client game::trading::tests` → `3 passed`, including `the_offers_scroll_by_the_wheel_delta` (one notch, a fractional delta, a two-and-a-half notch event, and both clamps). Compile-checked with `cargo check -p horizon-client --lib --bins`. **Not proven:** not checked in game. One correction worth stating: the ledger note for this row claimed a wheel sensitivity of 0.25 would stop the list moving. That is not what vanilla does — the truncation happens *after* the subtraction, so `3 - 0.25` still truncates to 2 and the list moves one row. The real difference is only in deltas above one unit, and the test pins the true behaviour rather than that claim. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:25:56 +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#6737
No description provided.