forge
Explore
Log in

Don't you dare go Hollow

Notice plate click-dismiss, z-order above maximized card, scale readout spacing

Browse files at this commit

5cafd7cceccd0daabf0c6f80345667004fa1643cAhmet Kaan GümüşParent: 0cf5087
  • fix
    • notice plate click-dismiss, z-order above maximized card, scale readout spacing
Show full message
🐛 fix(app): notice plate click-dismiss, z-order above maximized card, scale readout spacing

- notice_plate now takes cx and wires an on_mouse_down handler through the
  same Player::dismiss_notice path the key handler already uses, plus a
  pointer cursor.
- notice_plate mounts after the card_maximized block instead of beside
  ledger, so a maximized Mix/EQ card no longer paints over it.
- scale_plate's label/value gap and padding widened to match the notice
  plate's own comfortable padding idiom.
crates/app/src/ui/stance.rsmodified+24 -7
@@ -359,9 +359,9 @@ fn scale_plate(player: &Player) -> impl IntoElement {
359359 .flex_none()
360360 .flex()
361361 .items_center()
362- .gap(px(4.))
363- .px(px(6.))
364- .py(px(2.))
362+ .gap(px(6.))
363+ .px(px(10.))
364+ .py(px(6.))
365365 .rounded(px(2.))
366366 .bg(rgb(DARK_CANVAS()))
367367 .font(style.font)
@@ -778,12 +778,25 @@ pub(crate) fn notice_bottom_offset() -> f32 {
778778 /// only ever held plain text, no structured jump target, in either the
779779 /// legacy bar or here. Ceiling: give `notify_user` an optional jump payload
780780 /// once a call site actually has one to carry.
781-fn notice_plate(message: SharedString) -> impl IntoElement {
781+fn notice_plate(message: SharedString, cx: &mut Context<Player>) -> impl IntoElement {
782782 div()
783783 .id("stance-notice")
784784 .absolute()
785785 .bottom(px(notice_bottom_offset()))
786786 .right(px(12.))
787+ .cursor_pointer()
788+ // A click answers the notice the same way any other key does
789+ // (`stance-room`'s `on_key_down` -> `Player::dismiss_notice`):
790+ // the darkroom's own click-to-dismiss for a plate with no other
791+ // affordance on it (DESIGN §8).
792+ .on_mouse_down(
793+ MouseButton::Left,
794+ cx.listener(|this, _: &MouseDownEvent, _, cx| {
795+ if this.dismiss_notice() {
796+ cx.notify();
797+ }
798+ }),
799+ )
787800 // `max_w` only caps a box after GPUI has measured its text at
788801 // max-content width. `w_full` supplies a definite width to that
789802 // measurement (then `max_w` bounds it at 480 px), and normal
@@ -1173,9 +1186,6 @@ pub(crate) fn render(
11731186 .child(divider(Split::Bench, cx))
11741187 .child(bench(player, bench_h, window, cx))
11751188 .child(ledger(player, position))
1176- .when_some(player.notices.back().cloned(), |el, n| {
1177- el.child(notice_plate(n))
1178- })
11791189 .when(player.keys_open, |el| {
11801190 el.child(keys_overlay(player, bench_h, cx))
11811191 })
@@ -1221,6 +1231,13 @@ pub(crate) fn render(
12211231 .children(player.silence_card(window_size, cx))
12221232 .children(player.mix_card(window_size, cx))
12231233 .children(player.subtitle_style_card(window_size, cx))
1234+ })
1235+ // Mounted after `card_maximized` (not beside `ledger` above
1236+ // any more): a maximized Mix/EQ card painted over a notice
1237+ // sitting below it in this same child list, and a notice is
1238+ // transient -- it should win over a card, not lose to one.
1239+ .when_some(player.notices.back().cloned(), |el, n| {
1240+ el.child(notice_plate(n, cx))
12241241 }),
12251242 )
12261243 .child(divider(Split::Dock, cx))