Timeline: the mouse wheel scrolls the horizontal timeline (#3356) (#3409)

* claim: #3356

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0158is7fBbAVh538YmVF3MpZ

* Timeline: the mouse wheel scrolls the horizontal timeline (#3356)

The horizontal timeline is a horizontal-only scroll area, which egui scrolls
only with Shift + wheel or a sideways trackpad swipe, so with a plain mouse
wheel a history wider than the window could not be scrolled at all. The strip
now takes the vertical wheel as sideways scrolling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0158is7fBbAVh538YmVF3MpZ

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakobonly
2026-10-20 11:33:03 +00:00
committed by GitHub
parent c5b637600c
commit 9dfa9e2d52
+21
View File
@@ -287,6 +287,8 @@ pub fn timeline(app: &mut SolveApp, ui: &mut egui::Ui) {
// The features scroll horizontally in the space right of the playback controls.
let strip = Rect::from_min_max(pos2(x, r.top()), r.right_bottom());
ui.scope_builder(UiBuilder::new().max_rect(strip), |ui| {
// A plain mouse wheel scrolls the strip sideways too, not only Shift + wheel (#3356).
ui.style_mut().always_scroll_the_only_direction = true;
egui::ScrollArea::horizontal().auto_shrink([false, false]).show(ui, |ui| {
let p = ui.painter().clone();
let mut x = ui.max_rect().left();
@@ -624,6 +626,25 @@ mod tests {
h
}
/// A timeline wider than the window scrolls with a plain mouse wheel (#3356).
#[test]
fn the_mouse_wheel_scrolls_a_long_timeline() {
let mut h = Harness::new();
for i in 0..80 {
h.app.run("sketch.create", json!({"plane": "XY", "name": format!("S{i}")})).unwrap();
h.app.run("sketch.finish", json!({})).unwrap();
}
h.frames(4);
let first = crate::scenario::handle_at("timeline:S0").unwrap();
let last = crate::scenario::handle_at("timeline:S79").unwrap();
assert!(last.x > 1600.0, "the timeline runs past the 1600-point window: {last:?}");
h.call("ui.scroll", json!({"x": first.x + 200.0, "y": first.y, "delta": -400.0}));
h.frames(30);
let moved = crate::scenario::handle_at("timeline:S0").unwrap();
assert!(moved.x < first.x - 100.0, "the wheel scrolled the timeline: {first:?} → {moved:?}");
assert_eq!(moved.y, first.y);
}
#[test]
fn the_feature_menu_edits_its_profile_sketch_in_both_timelines() {
for left in [false, true] {