Notice plate off the transport row, keys overlay by the spine
Browse files at this commita1f9f08bfe0f93ee75c38a53787835fc3f6f12b0Parent: 24f6477- fix
- notice plate off the transport row, keys overlay by the spine
2 changed files +70 -47
- crates/app/src/tests/layout.rs +26 -25
- crates/app/src/ui/stance.rs +44 -22
crates/app/src/tests/layout.rsmodified+26 -25
| @@ -1907,31 +1907,32 @@ fn a_lane_row_fits_what_its_own_head_draws() { | |||
| 1907 | } | 1907 | } |
| 1908 | 1908 | ||
| 1909 | /// The notice plate's own anchor ([`crate::ui::stance::notice_bottom_offset`]) | 1909 | /// The notice plate's own anchor ([`crate::ui::stance::notice_bottom_offset`]) |
| 1910 | -/// keeps it off the bench, at *any* bench height -- not merely the floor -- | 1910 | +/// sits a fixed step above the ledger, not floated by `bench_h` -- a float |
| 1911 | -/// because its bottom offset always lands at or above the bench's own top | 1911 | +/// used to put the plate up beside the time band's transport timecode row |
| 1912 | -/// edge. `Player`'s live tree has no `TestAppContext` in this binary to mount | 1912 | +/// for a tall bench, reading as if it belonged to that row instead of the |
| 1913 | -/// a real `notice_plate` in and read its painted bounds back, so this checks | 1913 | +/// ledger it answers (user report). `Player`'s live tree has no |
| 1914 | -/// the pure geometry the anchor is built from instead (F2: previously the | 1914 | +/// `TestAppContext` in this binary to mount a real `notice_plate` in and |
| 1915 | -/// plate sat at a fixed `LEDGER_H + 6.` off the ledger and covered the | 1915 | +/// read its painted bounds back, so this checks the pure geometry the |
| 1916 | -/// V1/A1 lane chips whenever the bench was short enough for the plate's own | 1916 | +/// anchor is built from, and the source-level anchor that now keeps the |
| 1917 | -/// height to reach past it). | 1917 | +/// plate off the bench's left-aligned V1/A1 lane chips horizontally instead |
| 1918 | -#[test] | 1918 | +/// (right-aligned, DESIGN §11.6) rather than by floating with `bench_h`. |
| 1919 | -fn the_notice_plate_cannot_reach_the_bench_at_any_height() { | 1919 | +#[test] |
| 1920 | - use crate::BENCH_MIN_H; | 1920 | +fn the_notice_plate_sits_a_fixed_step_above_the_ledger_right_aligned() { |
| 1921 | - use crate::ui::stance::{BENCH_H, LEDGER_H, notice_bottom_offset}; | 1921 | + use crate::ui::stance::{LEDGER_H, notice_bottom_offset}; |
| 1922 | - | 1922 | + |
| 1923 | - for bench_h in [BENCH_MIN_H, BENCH_H, 400.] { | 1923 | + assert_eq!( |
| 1924 | - let notice_bottom = notice_bottom_offset(bench_h); | 1924 | + notice_bottom_offset(), |
| 1925 | - // The bench sits directly above the ledger in the centre column, so | 1925 | + LEDGER_H + 6., |
| 1926 | - // its own top edge (measured the same way, from the column's foot) | 1926 | + "the notice plate's bottom offset drifted off the ledger -- it must \ |
| 1927 | - // is exactly `LEDGER_H + bench_h`. | 1927 | + stay a fixed step above it, not float with bench_h again" |
| 1928 | - let bench_top = LEDGER_H + bench_h; | 1928 | + ); |
| 1929 | - assert!( | 1929 | + |
| 1930 | - notice_bottom >= bench_top, | 1930 | + let body = fn_body("notice_plate"); |
| 1931 | - "notice bottom {notice_bottom} sits below the bench's top {bench_top} \ | 1931 | + assert!( |
| 1932 | - at bench_h={bench_h} -- the plate can cover a lane row" | 1932 | + body.contains(".right(px(12.))") && !body.contains(".left(px(12.))"), |
| 1933 | - ); | 1933 | + "notice_plate must anchor right, clear of the bench's left-aligned \ |
| 1934 | - } | 1934 | + V1/A1 lane chips (DESIGN §11.6)" |
| 1935 | + ); | ||
| 1935 | } | 1936 | } |
| 1936 | /// The renderer only wraps text when the text measurement receives a definite | 1937 | /// The renderer only wraps text when the text measurement receives a definite |
| 1937 | /// width and normal whitespace. This source-level guard keeps both declarations | 1938 | /// width and normal whitespace. This source-level guard keeps both declarations |
crates/app/src/ui/stance.rsmodified+44 -22
| @@ -444,16 +444,27 @@ fn ghost( | |||
| 444 | /// Ceiling: DESIGN §12 step 7's full geographic pass (each region draws its | 444 | /// Ceiling: DESIGN §12 step 7's full geographic pass (each region draws its |
| 445 | /// own rows while held) -- §9's amendment names the 56 actions still | 445 | /// own rows while held) -- §9's amendment names the 56 actions still |
| 446 | /// without a home. | 446 | /// without a home. |
| 447 | -fn keys_overlay(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | 447 | +fn keys_overlay(player: &Player, bench_h: f32, cx: &mut Context<Player>) -> impl IntoElement { |
| 448 | div() | 448 | div() |
| 449 | .id("stance-keys-overlay") | 449 | .id("stance-keys-overlay") |
| 450 | .absolute() | 450 | .absolute() |
| 451 | .bottom_0() | 451 | .bottom_0() |
| 452 | .left_0() | 452 | .left_0() |
| 453 | .right_0() | 453 | .right_0() |
| 454 | - .h(px(BENCH_H + LEDGER_H)) | 454 | + // The live `bench_h` the caller already measures for `bench`/ |
| 455 | + // `notice_plate`, not the fixed `BENCH_H` default: a hand-dragged | ||
| 456 | + // bench taller than the default left this scrim short of the real | ||
| 457 | + // footprint, so the overlay stopped mid-bench instead of covering it. | ||
| 458 | + .h(px(bench_h + LEDGER_H)) | ||
| 455 | .bg(rgba(SCRIM())) | 459 | .bg(rgba(SCRIM())) |
| 456 | .flex() | 460 | .flex() |
| 461 | + // Bottom-left, not centred: the `?` control that opens this lives at | ||
| 462 | + // the foot of the spine ([`spine`]'s last child), and this overlay | ||
| 463 | + // mounts inside the *centre* column next to it -- anchoring the list | ||
| 464 | + // to this column's own bottom-left edge puts it flush against the | ||
| 465 | + // spine side, beside the control that opened it, instead of adrift | ||
| 466 | + // in the middle of the bench/ledger footprint (user report). | ||
| 467 | + .items_end() | ||
| 457 | // Click also dismisses (DESIGN §9): the hold-`?`-release above is | 468 | // Click also dismisses (DESIGN §9): the hold-`?`-release above is |
| 458 | // the fast door, this is the same scrim-press-closes contract every | 469 | // the fast door, this is the same scrim-press-closes contract every |
| 459 | // other card's scrim answers, so a hand that let go of `?` before | 470 | // other card's scrim answers, so a hand that let go of `?` before |
| @@ -469,8 +480,9 @@ fn keys_overlay(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | |||
| 469 | .child( | 480 | .child( |
| 470 | div() | 481 | div() |
| 471 | .id("stance-keys-list") | 482 | .id("stance-keys-list") |
| 472 | - .m_auto() | 483 | + .ml(px(12.)) |
| 473 | - .h(px(BENCH_H + LEDGER_H - 16.)) | 484 | + .mb(px(12.)) |
| 485 | + .h(px((bench_h + LEDGER_H - 24.).max(0.))) | ||
| 474 | .w(px(460.)) | 486 | .w(px(460.)) |
| 475 | .overflow_y_scroll() | 487 | .overflow_y_scroll() |
| 476 | .p(px(10.)) | 488 | .p(px(10.)) |
| @@ -720,11 +732,19 @@ fn notice_severity(message: &str) -> u32 { | |||
| 720 | 732 | ||
| 721 | /// [`notice_plate`]'s own `bottom` offset, pulled out as a pure function so | 733 | /// [`notice_plate`]'s own `bottom` offset, pulled out as a pure function so |
| 722 | /// a `TestAppContext`-less test binary (this crate's own, no live `Context` | 734 | /// a `TestAppContext`-less test binary (this crate's own, no live `Context` |
| 723 | -/// to mount a real `notice_plate` in) can still check the plate never lands | 735 | +/// to mount a real `notice_plate` in) can still check the anchor without |
| 724 | -/// over the bench, for any `bench_h` -- without duplicating the arithmetic | 736 | +/// duplicating the arithmetic by hand and risking the two drifting apart. |
| 725 | -/// by hand and risking the two drifting apart. | 737 | +/// |
| 726 | -pub(crate) fn notice_bottom_offset(bench_h: f32) -> f32 { | 738 | +/// Anchored a fixed `LEDGER_H + 6.` above the ledger, not floated by |
| 727 | - LEDGER_H + bench_h + 6. | 739 | +/// `bench_h` (F3, user report): floating it `bench_h` further up put the |
| 740 | +/// plate up beside the time band's transport timecode row for any tall | ||
| 741 | +/// bench, reading as if it belonged to that row instead of the ledger it | ||
| 742 | +/// answers. The old float existed only to dodge the bench's V1/A1 lane | ||
| 743 | +/// chips (F2) -- [`notice_plate`] now dodges those horizontally instead | ||
| 744 | +/// (right-aligned, DESIGN §11.6: the lane chips there are left-aligned), | ||
| 745 | +/// so the vertical float is no longer needed to keep the plate clear. | ||
| 746 | +pub(crate) fn notice_bottom_offset() -> f32 { | ||
| 747 | + LEDGER_H + 6. | ||
| 728 | } | 748 | } |
| 729 | 749 | ||
| 730 | /// A notice plate (DESIGN §8): one at a time, rising above the *bench*, its | 750 | /// A notice plate (DESIGN §8): one at a time, rising above the *bench*, its |
| @@ -743,25 +763,25 @@ pub(crate) fn notice_bottom_offset(bench_h: f32) -> f32 { | |||
| 743 | /// all. `back()` keeps the two in step and guarantees the newest, most | 763 | /// all. `back()` keeps the two in step and guarantees the newest, most |
| 744 | /// actionable message is always the one on screen. | 764 | /// actionable message is always the one on screen. |
| 745 | /// | 765 | /// |
| 746 | -/// Anchored off `bench_h` rather than a fixed offset off the ledger: at the | 766 | +/// Anchored a fixed [`notice_bottom_offset`] above the ledger, bottom-right |
| 747 | -/// bench's floor a fixed `LEDGER_H + 6.` bottom offset put the plate right | 767 | +/// (DESIGN §5's timecode/transport row lives bottom-left of the time band, |
| 748 | -/// over the V1/A1 lane chips -- a transient message hiding the lanes for as | 768 | +/// well above this): a `bench_h`-floated offset used to put the plate right |
| 749 | -/// long as it sat there. Floating it `bench_h` further up puts its bottom | 769 | +/// beside that transport row for a tall bench, reading as if it belonged to |
| 750 | -/// edge at the bench's own *top* edge for any bench height, so it always | 770 | +/// the wrong strip (user report). Right-aligned rather than left keeps it |
| 751 | -/// sits in the divider/time-band's slack above the bench rather than over | 771 | +/// off the bench's own V1/A1 lane chips, which are left-aligned there |
| 752 | -/// the lanes, and never has to reserve room in the bench itself for a | 772 | +/// (DESIGN §11.6 occlusion check) -- horizontal separation now does the job |
| 753 | -/// message that is not always there. | 773 | +/// the old vertical float existed for. |
| 754 | /// | 774 | /// |
| 755 | /// corner-cut: amber's "carries a jump action" is not wired -- the queue | 775 | /// corner-cut: amber's "carries a jump action" is not wired -- the queue |
| 756 | /// only ever held plain text, no structured jump target, in either the | 776 | /// only ever held plain text, no structured jump target, in either the |
| 757 | /// legacy bar or here. Ceiling: give `notify_user` an optional jump payload | 777 | /// legacy bar or here. Ceiling: give `notify_user` an optional jump payload |
| 758 | /// once a call site actually has one to carry. | 778 | /// once a call site actually has one to carry. |
| 759 | -fn notice_plate(message: SharedString, bench_h: f32) -> impl IntoElement { | 779 | +fn notice_plate(message: SharedString) -> impl IntoElement { |
| 760 | div() | 780 | div() |
| 761 | .id("stance-notice") | 781 | .id("stance-notice") |
| 762 | .absolute() | 782 | .absolute() |
| 763 | - .bottom(px(notice_bottom_offset(bench_h))) | 783 | + .bottom(px(notice_bottom_offset())) |
| 764 | - .left(px(12.)) | 784 | + .right(px(12.)) |
| 765 | // `max_w` only caps a box after GPUI has measured its text at | 785 | // `max_w` only caps a box after GPUI has measured its text at |
| 766 | // max-content width. `w_full` supplies a definite width to that | 786 | // max-content width. `w_full` supplies a definite width to that |
| 767 | // measurement (then `max_w` bounds it at 480 px), and normal | 787 | // measurement (then `max_w` bounds it at 480 px), and normal |
| @@ -1152,9 +1172,11 @@ pub(crate) fn render( | |||
| 1152 | .child(bench(player, bench_h, window, cx)) | 1172 | .child(bench(player, bench_h, window, cx)) |
| 1153 | .child(ledger(player, position)) | 1173 | .child(ledger(player, position)) |
| 1154 | .when_some(player.notices.back().cloned(), |el, n| { | 1174 | .when_some(player.notices.back().cloned(), |el, n| { |
| 1155 | - el.child(notice_plate(n, bench_h)) | 1175 | + el.child(notice_plate(n)) |
| 1176 | + }) | ||
| 1177 | + .when(player.keys_open, |el| { | ||
| 1178 | + el.child(keys_overlay(player, bench_h, cx)) | ||
| 1156 | }) | 1179 | }) |
| 1157 | - .when(player.keys_open, |el| el.child(keys_overlay(player, cx))) | ||
| 1158 | .when(player.settings_open, |el| { | 1180 | .when(player.settings_open, |el| { |
| 1159 | el.child(settings_stance::render(player, window_size, cx)) | 1181 | el.child(settings_stance::render(player, window_size, cx)) |
| 1160 | }) | 1182 | }) |