forge
Explore
Log in

Don't you dare go Hollow

The scrollbar strip is panel furniture, not lane pixels

Browse files at this commit

27b5f78ae6fba25f4aa627bf4554fc28aca0dc32Ahmet Kaan GümüşParent: 1027953
  • fix
    • the scrollbar strip is panel furniture, not lane pixels
Show full message
🐛 fix(timeline): the scrollbar strip is panel furniture, not lane pixels

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.rsmodified+30 -9
@@ -243,23 +243,44 @@ pub(crate) fn panel_h(lanes: usize) -> f32 {
243243 }
244244
245245 /// How tall the timeline region is: its own padding, the timecode line, the
246-/// ruler and the gaps between them, plus a row per lane. Measured from its
247-/// parts rather than taken off `PANEL_H` -- the button row moved out of it
246+/// ruler, the scrollbar strip under the lanes when there is one to draw, and
247+/// the gaps between them, plus a row per lane. Measured from its parts rather
248+/// than taken off `PANEL_H` -- the button row moved out of it
248249 /// ([`Player::toolbar`]), and a height still carrying that row's pixels is a
249250 /// height that cuts the last lane off the bottom of the window.
250-pub(crate) fn timeline_h(lanes: usize) -> f32 {
251- TIMELINE_FIXED_H + lanes_h(lanes.clamp(2, LANES_MAX))
251+pub(crate) fn timeline_h(lanes: usize, scroll: bool) -> f32 {
252+ timeline_fixed_h(scroll) + lanes_h(lanes.clamp(2, LANES_MAX))
252253 }
253254
254255 /// 8+8 padding, the timecode line, the 24 px ruler strip and the two 8 px gaps
255256 /// between the three rows, with a couple of px of slack so a taller text line
256-/// cannot push a lane off the bottom.
257+/// cannot push a lane off the bottom. The scrollbar strip's row is *not* here:
258+/// the strip comes and goes with the zoom, so its pixels are carried by
259+/// [`timeline_fixed_h`] alone, where every derivation that must agree with
260+/// what is drawn reads them together.
257261 pub(crate) const TIMELINE_FIXED_H: f32 = 16. + 18. + 8. + RULER_HIT_H + 8. + 4.;
258262
259-/// The most of a short window the timeline may take. At the 640x360 floor that
260-/// is 151 px of the 360, which leaves the picture a region rather than a
261-/// letterbox stripe -- and the lanes scroll inside it.
262-pub(crate) const TIMELINE_SHARE: f32 = 0.42;
263+/// The panel's fixed furniture with its scrollbar strip while the timeline has
264+/// somewhere to scroll to. With nowhere to go the strip is not drawn -- a bar
265+/// for a view that cannot move is a bar teaching nothing -- and its row goes
266+/// with it, out of every budget at once: a height still carrying the row would
267+/// hand it to the lane column as a bonus at exactly the zoom where the hand is
268+/// least expecting the bed to move.
269+pub(crate) fn timeline_fixed_h(scroll: bool) -> f32 {
270+ TIMELINE_FIXED_H + match scroll {
271+ true => 8. + SCROLL_HIT,
272+ false => 0.,
273+ }
274+}
275+
276+/// The most of a short window the timeline may take, sized so the seam's own
277+/// floor still fits inside it ([`split_bounds`]): at the 640x360 floor that is
278+/// 171 px of the 360 -- the chrome with the scrollbar strip in it, one whole
279+/// lane, and the line saying the rest are below. Left smaller than the floor
280+/// the floor would win the clamp anyway and this number would say the panel
281+/// takes less of a short window than it does. The lanes scroll inside whatever
282+/// is left, which leaves the picture a region rather than a letterbox stripe.
283+pub(crate) const TIMELINE_SHARE: f32 = 171. / 360.;
263284
264285 /// The edit toolbar directly above the timeline: one control's height in its
265286 /// own padding, fixed so nothing in it can push the timeline down.