From 99354cc5f9b9740b2229dcefa3f5b8620b6af108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 14 Aug 2026 19:15:59 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(ui):=20the=20lane=20header?= =?UTF-8?q?=20cut=20in=20half=20at=20the=20timeline's=20floor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The floor a timeline may be dragged to was one lane under the chrome, which left nothing for the line saying the rest of the tracks are below -- and that line is always drawn there once a project has a second track, out of the lane's own pixels. The header came out 27 px of its 48: the track's name, its subtitle dot and its × all cut in half. The affordance's line and gap are part of the floor now, so the lane it promises is a whole one. A size dragged with one track is raised to the new floor as it is read when a second arrives, not drawn under it. --- crates/app/src/layout.rs | 21 +++++++++++++++++---- crates/app/src/tests/layout.rs | 26 +++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/crates/app/src/layout.rs b/crates/app/src/layout.rs index 12df766..367bbf8 100644 --- a/crates/app/src/layout.rs +++ b/crates/app/src/layout.rs @@ -364,14 +364,27 @@ impl Splits { /// region rather than a sliver. Neither end is passable -- a panel dragged to /// nothing is a panel nobody can get back, and a picture squeezed out by two /// side columns is the same loss on the other side of the window. -pub(crate) fn split_bounds(split: Split, window: Size) -> (f32, f32) { +pub(crate) fn split_bounds(split: Split, lanes: usize, window: Size) -> (f32, f32) { let (w, h) = (f32::from(window.width), f32::from(window.height)); match split { Split::Library => (LIBRARY_MIN_W, w * SIDE_MAX_FRAC), Split::Inspector => (INSPECTOR_MIN_W, w * SIDE_MAX_FRAC), // One whole lane under the chrome: a timeline shorter than that is a - // ruler with nothing beneath it. - Split::Timeline => (TIMELINE_FIXED_H + LANE_H, h * TIMELINE_MAX_SHARE), + // ruler with nothing beneath it. A second track pays for the line that + // says the rest are below the fold as well -- at this height only one + // row fits, so that line is *always* drawn there, and it is drawn + // inside the region ([`Player::timeline`]). Left out of the floor it + // comes off the lane's own pixels, and the one lane the floor promises + // is a header cut in half. + Split::Timeline => ( + TIMELINE_FIXED_H + + LANE_H + + match lanes > 1 { + true => LABEL_H + 8., + false => 0., + }, + h * TIMELINE_MAX_SHARE, + ), } } @@ -386,7 +399,7 @@ pub(crate) fn split_size( window: Size, ) -> f32 { let (w, h) = (f32::from(window.width), f32::from(window.height)); - let (min, max) = split_bounds(split, window); + let (min, max) = split_bounds(split, lanes, window); let default = match split { Split::Library => library_w(w), Split::Inspector => inspector_w(w), diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index 946e55e..d522f4f 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -1243,10 +1243,34 @@ fn a_dragged_divider_stops_before_either_panel_disappears() { split_size(Split::Inspector, Some(-40.), 2, window), INSPECTOR_MIN_W ); + // The timeline's own floor is a floor with a whole lane *drawn* in it. At + // that height the column shows one row of a two-track project, so the line + // saying the rest are below is drawn too -- out of the region's pixels, + // not out of the lane's. Left unbudgeted the header came out 27 px of its + // 48 and the track's name, its subtitle dot and its × were cut in half. + let floor = split_size(Split::Timeline, Some(0.), 2, window); + assert_eq!(floor, TIMELINE_FIXED_H + LANE_H + LABEL_H + 8.); + // The same arithmetic the timeline lays the column out with + // ([`Player::timeline`]): what the affordance costs comes off the box, and + // a whole lane is still standing under it. + let lanes_box = floor - TIMELINE_FIXED_H; + assert!(2 > lanes_shown(lanes_box), "no line to pay for at the floor"); + assert!( + lanes_box - LABEL_H - 8. >= LANE_H, + "the floor leaves {} px for a {LANE_H} px lane", + lanes_box - LABEL_H - 8. + ); + // A lone track has nothing below it and pays nothing for the line -- the + // floor is a floor, not a reserved corridor. assert_eq!( - split_size(Split::Timeline, Some(0.), 2, window), + split_size(Split::Timeline, Some(0.), 1, window), TIMELINE_FIXED_H + LANE_H ); + // A size dragged with one track and kept while a second arrives is raised + // to the new floor as it is read, not silently drawn under it. + assert_eq!(split_size(Split::Timeline, Some(126.), 2, window), floor); + // And the floor still fits the share the shortest window gives the region. + assert!(floor <= 360. * TIMELINE_SHARE, "{floor} px will not fit"); assert_eq!( split_size(Split::Timeline, Some(9000.), 2, window), 720. * TIMELINE_MAX_SHARE