forge
Explore
Log in

Don't you dare go Hollow

Every hitmap control wears its hover plate

Browse files at this commit

0fd856c507227b4ae8cf817d4251802f81c79f1dAhmet Kaan GümüşParent: a4a6e6c
  • feat
    • every hitmap control wears its hover plate
Show full message
✨ feat(app): every hitmap control wears its hover plate

The user could not name the band's glyphs. One shape for the whole
room -- `<name> · <chord>` from the shared helper -- and a sweep that
pairs each `hitmap::` emitter with a `.tooltip(` of its own, so a plate
cannot be borrowed from the control next door: counting per function
let the empty-dock hint pay for `dock.sort.cycle`, which sat bare under
a green gate.
crates/app/src/tests/cards.rsmodified+3 -1
@@ -1085,7 +1085,9 @@ fn row_three_wears_the_encode_options_and_the_door_to_the_rest() {
1085 // the ink4 line the plan used to be.1085 // the ink4 line the plan used to be.
1086 let seg = cards1086 let seg = cards
1087 .find("fn moment_segment(")1087 .find("fn moment_segment(")
1088- .map(|at| &cards[at..at + 1200])1088+ // Wide enough for the atom's whole chain, plate included -- the
1089+ // hover line pushed the ink pair past the old 1200-char window.
1090+ .map(|at| &cards[at..at + 1900])
1089 .expect("the segment atom");1091 .expect("the segment atom");
1090 assert!(seg.contains("INK3()") && seg.contains("INK4()"));1092 assert!(seg.contains("INK3()") && seg.contains("INK4()"));
1091 assert!(seg.contains("DARK_RAISED()"), "a segment does not answer hover");1093 assert!(seg.contains("DARK_RAISED()"), "a segment does not answer hover");
crates/app/src/ui/cards.rsmodified+12 -1
@@ -229,6 +229,16 @@ fn moment_segment(
229 on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,229 on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,
230 ) -> impl IntoElement {230 ) -> impl IntoElement {
231 let text: SharedString = text.into();231 let text: SharedString = text.into();
232+ let chord: SharedString = chord.into();
233+ // The segment reads its *value* ("H.264 \u{b7} MP4"); the plate has to say
234+ // what pressing it does. Keyed off the id, so the next segment cannot
235+ // ship without one -- the sweep in `tests::layout` holds it to that.
236+ let name = match id {
237+ "moment-picture" => "Change the picture format",
238+ "moment-sound" => "Change the sound rate",
239+ "moment-encoder" => "Change the encoder seat",
240+ _ => "Open the export settings",
241+ };
232 let hitmap = hitmap::enabled().then(|| {242 let hitmap = hitmap::enabled().then(|| {
233 let label = text.clone();243 let label = text.clone();
234 hitmap::dynamic(move || (format!("card.{id}"), label.to_string()), true)244 hitmap::dynamic(move || (format!("card.{id}"), label.to_string()), true)
@@ -244,6 +254,7 @@ fn moment_segment(
244 .cursor_pointer()254 .cursor_pointer()
245 .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK2())))255 .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK2())))
246 .on_click(on_click)256 .on_click(on_click)
257+ .tooltip(crate::ui::widgets::overlay_tip_hover(name, &chord, None))
247 .children(hitmap.flatten())258 .children(hitmap.flatten())
248 .type_style(type_scale::mono(259 .type_style(type_scale::mono(
249 type_scale::CHORD_METADATA_MIN_PX,260 type_scale::CHORD_METADATA_MIN_PX,
@@ -251,7 +262,7 @@ fn moment_segment(
251 ))262 ))
252 .text_color(rgb(INK3()))263 .text_color(rgb(INK3()))
253 .child(text)264 .child(text)
254- .child(div().flex_none().text_color(rgb(INK4())).child(chord.into()))265+ .child(div().flex_none().text_color(rgb(INK4())).child(chord))
255 }266 }
256 267
257 fn dark_ghost_button(268 fn dark_ghost_button(