From 27b5f78ae6fba25f4aa627bf4554fc28aca0dc32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 16 Aug 2026 00:18:30 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(timeline):=20the=20scrollbar?= =?UTF-8?q?=20strip=20is=20panel=20furniture,=20not=20lane=20pixels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit f69ba33 stood the new strip under the lanes as one more flex_none row of the panel but left TIMELINE_FIXED_H describing a panel without it, and every lane-height decision reads that number: the region's own height (timeline_h), the fold the column is laid out against (lanes_box), and the seam's drag floor. The region came out 22 px short of its furniture, the flex_1 lane column paid the difference, and the last lane slid under the fold cut to 28 of its 48 px -- the lane-header-cut-in-half class again, now at the default size, with the affordance silent because the prediction still said the lane fit. The strip's row (SCROLL_HIT_H and its gap) now rides in TIMELINE_FIXED_H beside the ruler's, and TIMELINE_SHARE grows to the floor that yields: 171 px of the 360 at the 640x360 floor, where the old 0.42 (151 px) is smaller than the floor and the clamp made the floor the answer anyway -- the share said the panel took less of a short window than it did. The pixels at that floor do not move; the two constants agree again. --- crates/app/src/layout.rs | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/crates/app/src/layout.rs b/crates/app/src/layout.rs index d7e6700..82aba04 100644 --- a/crates/app/src/layout.rs +++ b/crates/app/src/layout.rs @@ -243,23 +243,44 @@ pub(crate) fn panel_h(lanes: usize) -> f32 { } /// How tall the timeline region is: its own padding, the timecode line, the -/// ruler and the gaps between them, plus a row per lane. Measured from its -/// parts rather than taken off `PANEL_H` -- the button row moved out of it +/// ruler, the scrollbar strip under the lanes when there is one to draw, and +/// the gaps between them, plus a row per lane. Measured from its parts rather +/// than taken off `PANEL_H` -- the button row moved out of it /// ([`Player::toolbar`]), and a height still carrying that row's pixels is a /// height that cuts the last lane off the bottom of the window. -pub(crate) fn timeline_h(lanes: usize) -> f32 { - TIMELINE_FIXED_H + lanes_h(lanes.clamp(2, LANES_MAX)) +pub(crate) fn timeline_h(lanes: usize, scroll: bool) -> f32 { + timeline_fixed_h(scroll) + lanes_h(lanes.clamp(2, LANES_MAX)) } /// 8+8 padding, the timecode line, the 24 px ruler strip and the two 8 px gaps /// between the three rows, with a couple of px of slack so a taller text line -/// cannot push a lane off the bottom. +/// cannot push a lane off the bottom. The scrollbar strip's row is *not* here: +/// the strip comes and goes with the zoom, so its pixels are carried by +/// [`timeline_fixed_h`] alone, where every derivation that must agree with +/// what is drawn reads them together. pub(crate) const TIMELINE_FIXED_H: f32 = 16. + 18. + 8. + RULER_HIT_H + 8. + 4.; -/// The most of a short window the timeline may take. At the 640x360 floor that -/// is 151 px of the 360, which leaves the picture a region rather than a -/// letterbox stripe -- and the lanes scroll inside it. -pub(crate) const TIMELINE_SHARE: f32 = 0.42; +/// The panel's fixed furniture with its scrollbar strip while the timeline has +/// somewhere to scroll to. With nowhere to go the strip is not drawn -- a bar +/// for a view that cannot move is a bar teaching nothing -- and its row goes +/// with it, out of every budget at once: a height still carrying the row would +/// hand it to the lane column as a bonus at exactly the zoom where the hand is +/// least expecting the bed to move. +pub(crate) fn timeline_fixed_h(scroll: bool) -> f32 { + TIMELINE_FIXED_H + match scroll { + true => 8. + SCROLL_HIT, + false => 0., + } +} + +/// The most of a short window the timeline may take, sized so the seam's own +/// floor still fits inside it ([`split_bounds`]): at the 640x360 floor that is +/// 171 px of the 360 -- the chrome with the scrollbar strip in it, one whole +/// lane, and the line saying the rest are below. Left smaller than the floor +/// the floor would win the clamp anyway and this number would say the panel +/// takes less of a short window than it does. The lanes scroll inside whatever +/// is left, which leaves the picture a region rather than a letterbox stripe. +pub(crate) const TIMELINE_SHARE: f32 = 171. / 360.; /// The edit toolbar directly above the timeline: one control's height in its /// own padding, fixed so nothing in it can push the timeline down.