forge
Explore
Log in

Don't you dare go Hollow

The lane header cut in half at the timeline's floor

Browse files at this commit

99354cc5f9b9740b2229dcefa3f5b8620b6af108Ahmet Kaan GümüşParent: 0ec584d
  • fix
    • the lane header cut in half at the timeline's floor
Show full message
🐛 fix(ui): the lane header cut in half at the timeline's floor

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.rsmodified+17 -4
@@ -364,14 +364,27 @@ impl Splits {
364 /// region rather than a sliver. Neither end is passable -- a panel dragged to364 /// region rather than a sliver. Neither end is passable -- a panel dragged to
365 /// nothing is a panel nobody can get back, and a picture squeezed out by two365 /// nothing is a panel nobody can get back, and a picture squeezed out by two
366 /// side columns is the same loss on the other side of the window.366 /// side columns is the same loss on the other side of the window.
367-pub(crate) fn split_bounds(split: Split, window: Size<Pixels>) -> (f32, f32) {367+pub(crate) fn split_bounds(split: Split, lanes: usize, window: Size<Pixels>) -> (f32, f32) {
368 let (w, h) = (f32::from(window.width), f32::from(window.height));368 let (w, h) = (f32::from(window.width), f32::from(window.height));
369 match split {369 match split {
370 Split::Library => (LIBRARY_MIN_W, w * SIDE_MAX_FRAC),370 Split::Library => (LIBRARY_MIN_W, w * SIDE_MAX_FRAC),
371 Split::Inspector => (INSPECTOR_MIN_W, w * SIDE_MAX_FRAC),371 Split::Inspector => (INSPECTOR_MIN_W, w * SIDE_MAX_FRAC),
372 // One whole lane under the chrome: a timeline shorter than that is a372 // One whole lane under the chrome: a timeline shorter than that is a
373- // ruler with nothing beneath it.373+ // ruler with nothing beneath it. A second track pays for the line that
374- Split::Timeline => (TIMELINE_FIXED_H + LANE_H, h * TIMELINE_MAX_SHARE),374+ // says the rest are below the fold as well -- at this height only one
375+ // row fits, so that line is *always* drawn there, and it is drawn
376+ // inside the region ([`Player::timeline`]). Left out of the floor it
377+ // comes off the lane's own pixels, and the one lane the floor promises
378+ // is a header cut in half.
379+ Split::Timeline => (
380+ TIMELINE_FIXED_H
381+ + LANE_H
382+ + match lanes > 1 {
383+ true => LABEL_H + 8.,
384+ false => 0.,
385+ },
386+ h * TIMELINE_MAX_SHARE,
387+ ),
375 }388 }
376 }389 }
377 390
@@ -386,7 +399,7 @@ pub(crate) fn split_size(
386 window: Size<Pixels>,399 window: Size<Pixels>,
387 ) -> f32 {400 ) -> f32 {
388 let (w, h) = (f32::from(window.width), f32::from(window.height));401 let (w, h) = (f32::from(window.width), f32::from(window.height));
389- let (min, max) = split_bounds(split, window);402+ let (min, max) = split_bounds(split, lanes, window);
390 let default = match split {403 let default = match split {
391 Split::Library => library_w(w),404 Split::Library => library_w(w),
392 Split::Inspector => inspector_w(w),405 Split::Inspector => inspector_w(w),
crates/app/src/tests/layout.rsmodified+25 -1
@@ -1243,10 +1243,34 @@ fn a_dragged_divider_stops_before_either_panel_disappears() {
1243 split_size(Split::Inspector, Some(-40.), 2, window),1243 split_size(Split::Inspector, Some(-40.), 2, window),
1244 INSPECTOR_MIN_W1244 INSPECTOR_MIN_W
1245 );1245 );
1246+ // The timeline's own floor is a floor with a whole lane *drawn* in it. At
1247+ // that height the column shows one row of a two-track project, so the line
1248+ // saying the rest are below is drawn too -- out of the region's pixels,
1249+ // not out of the lane's. Left unbudgeted the header came out 27 px of its
1250+ // 48 and the track's name, its subtitle dot and its × were cut in half.
1251+ let floor = split_size(Split::Timeline, Some(0.), 2, window);
1252+ assert_eq!(floor, TIMELINE_FIXED_H + LANE_H + LABEL_H + 8.);
1253+ // The same arithmetic the timeline lays the column out with
1254+ // ([`Player::timeline`]): what the affordance costs comes off the box, and
1255+ // a whole lane is still standing under it.
1256+ let lanes_box = floor - TIMELINE_FIXED_H;
1257+ assert!(2 > lanes_shown(lanes_box), "no line to pay for at the floor");
1258+ assert!(
1259+ lanes_box - LABEL_H - 8. >= LANE_H,
1260+ "the floor leaves {} px for a {LANE_H} px lane",
1261+ lanes_box - LABEL_H - 8.
1262+ );
1263+ // A lone track has nothing below it and pays nothing for the line -- the
1264+ // floor is a floor, not a reserved corridor.
1246 assert_eq!(1265 assert_eq!(
1247- split_size(Split::Timeline, Some(0.), 2, window),1266+ split_size(Split::Timeline, Some(0.), 1, window),
1248 TIMELINE_FIXED_H + LANE_H1267 TIMELINE_FIXED_H + LANE_H
1249 );1268 );
1269+ // A size dragged with one track and kept while a second arrives is raised
1270+ // to the new floor as it is read, not silently drawn under it.
1271+ assert_eq!(split_size(Split::Timeline, Some(126.), 2, window), floor);
1272+ // And the floor still fits the share the shortest window gives the region.
1273+ assert!(floor <= 360. * TIMELINE_SHARE, "{floor} px will not fit");
1250 assert_eq!(1274 assert_eq!(
1251 split_size(Split::Timeline, Some(9000.), 2, window),1275 split_size(Split::Timeline, Some(9000.), 2, window),
1252 720. * TIMELINE_MAX_SHARE1276 720. * TIMELINE_MAX_SHARE