forge
Explore
Log in

Don't you dare go Hollow

Notice plate off the transport row, keys overlay by the spine

Browse files at this commit

a1f9f08bfe0f93ee75c38a53787835fc3f6f12b0Ahmet Kaan GümüşParent: 24f6477
  • fix
    • notice plate off the transport row, keys overlay by the spine
Show full message
🐛 fix(app): notice plate off the transport row, keys overlay by the spine

Notice plate: anchor a fixed LEDGER_H+6 above the ledger, right-aligned
(was floating notice_bottom_offset(bench_h) up beside the time band's
transport row for a tall bench; now clear via the same left/right split
that already keeps the bench's V1/A1 lane chips separate, DESIGN §11.6).

Keys overlay (`?`): sized against the live bench_h the caller already
measures, not the fixed BENCH_H default, and anchored bottom-left flush
against the spine (the `?` control's own side) instead of m_auto-centred.
crates/app/src/tests/layout.rsmodified+26 -25
@@ -1907,31 +1907,32 @@ fn a_lane_row_fits_what_its_own_head_draws() {
19071907 }
19081908
19091909 /// 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 --
1911-/// because its bottom offset always lands at or above the bench's own top
1912-/// edge. `Player`'s live tree has no `TestAppContext` in this binary to mount
1913-/// a real `notice_plate` in and read its painted bounds back, so this checks
1914-/// the pure geometry the anchor is built from instead (F2: previously the
1915-/// plate sat at a fixed `LEDGER_H + 6.` off the ledger and covered the
1916-/// V1/A1 lane chips whenever the bench was short enough for the plate's own
1917-/// height to reach past it).
1918-#[test]
1919-fn the_notice_plate_cannot_reach_the_bench_at_any_height() {
1920- use crate::BENCH_MIN_H;
1921- use crate::ui::stance::{BENCH_H, LEDGER_H, notice_bottom_offset};
1922-
1923- for bench_h in [BENCH_MIN_H, BENCH_H, 400.] {
1924- let notice_bottom = notice_bottom_offset(bench_h);
1925- // The bench sits directly above the ledger in the centre column, so
1926- // its own top edge (measured the same way, from the column's foot)
1927- // is exactly `LEDGER_H + bench_h`.
1928- let bench_top = LEDGER_H + bench_h;
1929- assert!(
1930- notice_bottom >= bench_top,
1931- "notice bottom {notice_bottom} sits below the bench's top {bench_top} \
1932- at bench_h={bench_h} -- the plate can cover a lane row"
1933- );
1934- }
1910+/// sits a fixed step above the ledger, not floated by `bench_h` -- a float
1911+/// used to put the plate up beside the time band's transport timecode row
1912+/// for a tall bench, reading as if it belonged to that row instead of the
1913+/// ledger it answers (user report). `Player`'s live tree has no
1914+/// `TestAppContext` in this binary to mount a real `notice_plate` in and
1915+/// read its painted bounds back, so this checks the pure geometry the
1916+/// anchor is built from, and the source-level anchor that now keeps the
1917+/// plate off the bench's left-aligned V1/A1 lane chips horizontally instead
1918+/// (right-aligned, DESIGN §11.6) rather than by floating with `bench_h`.
1919+#[test]
1920+fn the_notice_plate_sits_a_fixed_step_above_the_ledger_right_aligned() {
1921+ use crate::ui::stance::{LEDGER_H, notice_bottom_offset};
1922+
1923+ assert_eq!(
1924+ notice_bottom_offset(),
1925+ LEDGER_H + 6.,
1926+ "the notice plate's bottom offset drifted off the ledger -- it must \
1927+ stay a fixed step above it, not float with bench_h again"
1928+ );
1929+
1930+ let body = fn_body("notice_plate");
1931+ assert!(
1932+ body.contains(".right(px(12.))") && !body.contains(".left(px(12.))"),
1933+ "notice_plate must anchor right, clear of the bench's left-aligned \
1934+ V1/A1 lane chips (DESIGN §11.6)"
1935+ );
19351936 }
19361937 /// The renderer only wraps text when the text measurement receives a definite
19371938 /// 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(
444444 /// Ceiling: DESIGN §12 step 7's full geographic pass (each region draws its
445445 /// own rows while held) -- §9's amendment names the 56 actions still
446446 /// 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 {
448448 div()
449449 .id("stance-keys-overlay")
450450 .absolute()
451451 .bottom_0()
452452 .left_0()
453453 .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))
455459 .bg(rgba(SCRIM()))
456460 .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()
457468 // Click also dismisses (DESIGN §9): the hold-`?`-release above is
458469 // the fast door, this is the same scrim-press-closes contract every
459470 // 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 {
469480 .child(
470481 div()
471482 .id("stance-keys-list")
472- .m_auto()
473- .h(px(BENCH_H + LEDGER_H - 16.))
483+ .ml(px(12.))
484+ .mb(px(12.))
485+ .h(px((bench_h + LEDGER_H - 24.).max(0.)))
474486 .w(px(460.))
475487 .overflow_y_scroll()
476488 .p(px(10.))
@@ -720,11 +732,19 @@ fn notice_severity(message: &str) -> u32 {
720732
721733 /// [`notice_plate`]'s own `bottom` offset, pulled out as a pure function so
722734 /// 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
724-/// over the bench, for any `bench_h` -- without duplicating the arithmetic
725-/// by hand and risking the two drifting apart.
726-pub(crate) fn notice_bottom_offset(bench_h: f32) -> f32 {
727- LEDGER_H + bench_h + 6.
735+/// to mount a real `notice_plate` in) can still check the anchor without
736+/// duplicating the arithmetic by hand and risking the two drifting apart.
737+///
738+/// Anchored a fixed `LEDGER_H + 6.` above the ledger, not floated by
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.
728748 }
729749
730750 /// 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 {
743763 /// all. `back()` keeps the two in step and guarantees the newest, most
744764 /// actionable message is always the one on screen.
745765 ///
746-/// Anchored off `bench_h` rather than a fixed offset off the ledger: at the
747-/// bench's floor a fixed `LEDGER_H + 6.` bottom offset put the plate right
748-/// over the V1/A1 lane chips -- a transient message hiding the lanes for as
749-/// long as it sat there. Floating it `bench_h` further up puts its bottom
750-/// edge at the bench's own *top* edge for any bench height, so it always
751-/// sits in the divider/time-band's slack above the bench rather than over
752-/// the lanes, and never has to reserve room in the bench itself for a
753-/// message that is not always there.
766+/// Anchored a fixed [`notice_bottom_offset`] above the ledger, bottom-right
767+/// (DESIGN §5's timecode/transport row lives bottom-left of the time band,
768+/// well above this): a `bench_h`-floated offset used to put the plate right
769+/// beside that transport row for a tall bench, reading as if it belonged to
770+/// the wrong strip (user report). Right-aligned rather than left keeps it
771+/// off the bench's own V1/A1 lane chips, which are left-aligned there
772+/// (DESIGN §11.6 occlusion check) -- horizontal separation now does the job
773+/// the old vertical float existed for.
754774 ///
755775 /// corner-cut: amber's "carries a jump action" is not wired -- the queue
756776 /// only ever held plain text, no structured jump target, in either the
757777 /// legacy bar or here. Ceiling: give `notify_user` an optional jump payload
758778 /// 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 {
760780 div()
761781 .id("stance-notice")
762782 .absolute()
763- .bottom(px(notice_bottom_offset(bench_h)))
764- .left(px(12.))
783+ .bottom(px(notice_bottom_offset()))
784+ .right(px(12.))
765785 // `max_w` only caps a box after GPUI has measured its text at
766786 // max-content width. `w_full` supplies a definite width to that
767787 // measurement (then `max_w` bounds it at 480 px), and normal
@@ -1152,9 +1172,11 @@ pub(crate) fn render(
11521172 .child(bench(player, bench_h, window, cx))
11531173 .child(ledger(player, position))
11541174 .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))
11561179 })
1157- .when(player.keys_open, |el| el.child(keys_overlay(player, cx)))
11581180 .when(player.settings_open, |el| {
11591181 el.child(settings_stance::render(player, window_size, cx))
11601182 })