Merge branch 'worktree-agent-af997112920a4dd82'
Browse files at this commit1 changed file +24 -7
- crates/app/src/ui/stance.rs +24 -7
crates/app/src/ui/stance.rsmodified+24 -7
| @@ -359,9 +359,9 @@ fn scale_plate(player: &Player) -> impl IntoElement { | |||
| 359 | .flex_none() | 359 | .flex_none() |
| 360 | .flex() | 360 | .flex() |
| 361 | .items_center() | 361 | .items_center() |
| 362 | - .gap(px(4.)) | 362 | + .gap(px(6.)) |
| 363 | - .px(px(6.)) | 363 | + .px(px(10.)) |
| 364 | - .py(px(2.)) | 364 | + .py(px(6.)) |
| 365 | .rounded(px(2.)) | 365 | .rounded(px(2.)) |
| 366 | .bg(rgb(DARK_CANVAS())) | 366 | .bg(rgb(DARK_CANVAS())) |
| 367 | .font(style.font) | 367 | .font(style.font) |
| @@ -778,12 +778,25 @@ pub(crate) fn notice_bottom_offset() -> f32 { | |||
| 778 | /// only ever held plain text, no structured jump target, in either the | 778 | /// only ever held plain text, no structured jump target, in either the |
| 779 | /// legacy bar or here. Ceiling: give `notify_user` an optional jump payload | 779 | /// legacy bar or here. Ceiling: give `notify_user` an optional jump payload |
| 780 | /// once a call site actually has one to carry. | 780 | /// 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 { |
| 782 | div() | 782 | div() |
| 783 | .id("stance-notice") | 783 | .id("stance-notice") |
| 784 | .absolute() | 784 | .absolute() |
| 785 | .bottom(px(notice_bottom_offset())) | 785 | .bottom(px(notice_bottom_offset())) |
| 786 | .right(px(12.)) | 786 | .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 | + ) | ||
| 787 | // `max_w` only caps a box after GPUI has measured its text at | 800 | // `max_w` only caps a box after GPUI has measured its text at |
| 788 | // max-content width. `w_full` supplies a definite width to that | 801 | // max-content width. `w_full` supplies a definite width to that |
| 789 | // measurement (then `max_w` bounds it at 480 px), and normal | 802 | // measurement (then `max_w` bounds it at 480 px), and normal |
| @@ -1173,9 +1186,6 @@ pub(crate) fn render( | |||
| 1173 | .child(divider(Split::Bench, cx)) | 1186 | .child(divider(Split::Bench, cx)) |
| 1174 | .child(bench(player, bench_h, window, cx)) | 1187 | .child(bench(player, bench_h, window, cx)) |
| 1175 | .child(ledger(player, position)) | 1188 | .child(ledger(player, position)) |
| 1176 | - .when_some(player.notices.back().cloned(), |el, n| { | ||
| 1177 | - el.child(notice_plate(n)) | ||
| 1178 | - }) | ||
| 1179 | .when(player.keys_open, |el| { | 1189 | .when(player.keys_open, |el| { |
| 1180 | el.child(keys_overlay(player, bench_h, cx)) | 1190 | el.child(keys_overlay(player, bench_h, cx)) |
| 1181 | }) | 1191 | }) |
| @@ -1221,6 +1231,13 @@ pub(crate) fn render( | |||
| 1221 | .children(player.silence_card(window_size, cx)) | 1231 | .children(player.silence_card(window_size, cx)) |
| 1222 | .children(player.mix_card(window_size, cx)) | 1232 | .children(player.mix_card(window_size, cx)) |
| 1223 | .children(player.subtitle_style_card(window_size, cx)) | 1233 | .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)) | ||
| 1224 | }), | 1241 | }), |
| 1225 | ) | 1242 | ) |
| 1226 | .child(divider(Split::Dock, cx)) | 1243 | .child(divider(Split::Dock, cx)) |