forge
Explore
Log in

Don't you dare go Hollow

merge oldui-hitmap

Browse files at this commit

b90da6d8f2ee0a78d0f8138dd4333737fb4f3661Ahmet Kaan GümüşParent: 9a27ee61fa9758
crates/app/src/tests/layout.rsmodified+6 -0
@@ -2660,6 +2660,12 @@ fn every_action_has_a_darkroom_widget_home_or_explicit_owner() {
2660 let mentioned = darkroom.contains(&format!("ActionId::{name}"))2660 let mentioned = darkroom.contains(&format!("ActionId::{name}"))
2661 || (action == ActionId::Resolution && darkroom.contains("Pick::Resolution"))2661 || (action == ActionId::Resolution && darkroom.contains("Pick::Resolution"))
2662 || (action == ActionId::SubtitleStyle && darkroom.contains("open_subtitle_style(cx)"));2662 || (action == ActionId::SubtitleStyle && darkroom.contains("open_subtitle_style(cx)"));
2663+ let hitmap_id = crate::ui::hitmap::action_id(action);
2664+ assert_eq!(
2665+ hitmap_id,
2666+ format!("action.{name}"),
2667+ "ActionId::{name} has a Darkroom widget home but no stable hitmap id"
2668+ );
2663 assert!(2669 assert!(
2664 mentioned,2670 mentioned,
2665 "ActionId::{name} is bound to a chord but has no visible affordance \2671 "ActionId::{name} is bound to a chord but has no visible affordance \
crates/app/src/ui/bench_stance.rsmodified+64 -0
@@ -38,6 +38,7 @@
38 //! `nudge_cut` and friends still act on `Player::selected` directly, with no38 //! `nudge_cut` and friends still act on `Player::selected` directly, with no
39 //! element under the pointer required, and stay untouched by any of this.39 //! element under the pointer required, and stay untouched by any of this.
40 40
41+use crate::ui::hitmap;
41 use crate::ui::type_scale::{self, Typeset};42 use crate::ui::type_scale::{self, Typeset};
42 use crate::ui::widgets::*;43 use crate::ui::widgets::*;
43 use crate::*;44 use crate::*;
@@ -306,6 +307,15 @@ fn clip_box(
306 move |_, _, _, cx| cx.new(|_| Tip(ghost.clone()))307 move |_, _, _, cx| cx.new(|_| Tip(ghost.clone()))
307 },308 },
308 )309 )
310+ .children(hitmap::dynamic(
311+ move || {
312+ (
313+ format!("clip.{}.{}.{}", lane.label(), lane.ord, idx),
314+ "Timeline clip".into(),
315+ )
316+ },
317+ true,
318+ ))
309 // The two edge strips a drag lengthens or shortens the clip by319 // The two edge strips a drag lengthens or shortens the clip by
310 // (`Player::start_trim`), gated on the same `trims(span)` floor the320 // (`Player::start_trim`), gated on the same `trims(span)` floor the
311 // legacy strips use -- a clip too narrow to aim at keeps its whole321 // legacy strips use -- a clip too narrow to aim at keeps its whole
@@ -507,6 +517,15 @@ fn clip_box(
507 this.pick((lane, idx), false, cx);517 this.pick((lane, idx), false, cx);
508 this.dissolve_selected(cx);518 this.dissolve_selected(cx);
509 }))519 }))
520+ .children(hitmap::dynamic(
521+ move || {
522+ (
523+ format!("clip.{}.{}.{}.dissolve", lane.label(), lane.ord, idx),
524+ "Toggle dissolve".into(),
525+ )
526+ },
527+ true,
528+ ))
510 .child(dissolve_glyph()),529 .child(dissolve_glyph()),
511 )530 )
512 })531 })
@@ -627,6 +646,15 @@ fn sub_box(
627 move |_, _, _, cx| cx.new(|_| Tip(ghost.clone()))646 move |_, _, _, cx| cx.new(|_| Tip(ghost.clone()))
628 },647 },
629 )648 )
649+ .children(hitmap::dynamic(
650+ move || {
651+ (
652+ format!("subtitle.{}.{}.{}", lane.label(), lane.ord, idx),
653+ "Timeline subtitle".into(),
654+ )
655+ },
656+ true,
657+ ))
630 // The same edge-trim strips a clip gets, on the same [`trims`] floor.658 // The same edge-trim strips a clip gets, on the same [`trims`] floor.
631 .children(659 .children(
632 [Edge::Start, Edge::End]660 [Edge::Start, Edge::End]
@@ -823,6 +851,15 @@ fn lane_row(
823 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {851 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
824 this.act_lane(ActionId::Mix, lane, cx);852 this.act_lane(ActionId::Mix, lane, cx);
825 }))853 }))
854+ .children(hitmap::dynamic(
855+ move || {
856+ (
857+ format!("lane.{}.mix", lane.label()),
858+ format!("Mix {}", lane.label()),
859+ )
860+ },
861+ true,
862+ ))
826 .child("≋")863 .child("≋")
827 .child(864 .child(
828 div()865 div()
@@ -855,6 +892,15 @@ fn lane_row(
855 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {892 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
856 this.show_sub_lane(lane, cx);893 this.show_sub_lane(lane, cx);
857 }))894 }))
895+ .children(hitmap::dynamic(
896+ move || {
897+ (
898+ format!("lane.{}.subtitles", lane.label()),
899+ format!("Show {}", lane.label()),
900+ )
901+ },
902+ true,
903+ ))
858 .child("◉"),904 .child("◉"),
859 )905 )
860 })906 })
@@ -887,6 +933,15 @@ fn lane_row(
887 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {933 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
888 this.act_lane(action, lane, cx);934 this.act_lane(action, lane, cx);
889 }))935 }))
936+ .children(hitmap::dynamic(
937+ move || {
938+ (
939+ format!("lane.{}.remove", lane.label()),
940+ format!("Remove {}", lane.label()),
941+ )
942+ },
943+ player.enable(action, None).yes(),
944+ ))
890 .child("×")945 .child("×")
891 .child(946 .child(
892 div()947 div()
@@ -1010,6 +1065,15 @@ fn lane_row(
1010 cx.stop_propagation();1065 cx.stop_propagation();
1011 this.timeline_wheel(event, cx);1066 this.timeline_wheel(event, cx);
1012 }))1067 }))
1068+ .children(hitmap::dynamic(
1069+ move || {
1070+ (
1071+ format!("lane.{}.bed", lane.label()),
1072+ format!("{} timeline bed", lane.label()),
1073+ )
1074+ },
1075+ true,
1076+ ))
1013 .children(boxes)1077 .children(boxes)
1014 .children(sub_boxes)1078 .children(sub_boxes)
1015 // The shadow of the row in flight (`Player::ghost`, set by1079 // The shadow of the row in flight (`Player::ghost`, set by
crates/app/src/ui/cards.rsmodified+27 -3
@@ -1,5 +1,6 @@
1 //! The property cards -- docked into the inspector, or floated when modal.1 //! The property cards -- docked into the inspector, or floated when modal.
2 2
3+use crate::ui::hitmap;
3 use crate::ui::type_scale::{self, Typeset};4 use crate::ui::type_scale::{self, Typeset};
4 use crate::ui::widgets::*;5 use crate::ui::widgets::*;
5 use crate::*;6 use crate::*;
@@ -121,6 +122,7 @@ fn dark_card_head(
121 .into()122 .into()
122 })123 })
123 .child(if max { "▣ m" } else { "⤢ m" })124 .child(if max { "▣ m" } else { "⤢ m" })
125+ .children(hitmap::control("card.maximize", "Toggle card size", true))
124 }))126 }))
125 .child(127 .child(
126 div()128 div()
@@ -179,8 +181,21 @@ fn dark_step_glyph(
179 plus: bool,181 plus: bool,
180 on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,182 on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,
181 ) -> impl IntoElement {183 ) -> impl IntoElement {
184+ let id = id.into();
185+ let hitmap = hitmap::enabled().then(|| {
186+ let id = id.to_string();
187+ hitmap::dynamic(
188+ move || {
189+ (
190+ format!("card.{id}"),
191+ if plus { "Increase" } else { "Decrease" }.into(),
192+ )
193+ },
194+ true,
195+ )
196+ });
182 div()197 div()
183- .id(id.into())198+ .id(id)
184 .flex_none()199 .flex_none()
185 .w(px(HIT_MIN))200 .w(px(HIT_MIN))
186 .h(px(KEYS_ROW_H))201 .h(px(KEYS_ROW_H))
@@ -191,6 +206,7 @@ fn dark_step_glyph(
191 .cursor_pointer()206 .cursor_pointer()
192 .hover(|s| s.bg(rgb(DARK_RAISED())))207 .hover(|s| s.bg(rgb(DARK_RAISED())))
193 .on_click(on_click)208 .on_click(on_click)
209+ .children(hitmap.flatten())
194 .child(dark_row_value(if plus { "+" } else { "−" }))210 .child(dark_row_value(if plus { "+" } else { "−" }))
195 }211 }
196 212
@@ -201,8 +217,15 @@ fn dark_ghost_button(
201 active: bool,217 active: bool,
202 on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,218 on_click: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,
203 ) -> impl IntoElement {219 ) -> impl IntoElement {
220+ let id = id.into();
221+ let text: SharedString = text.into();
222+ let hitmap = hitmap::enabled().then(|| {
223+ let id = id.to_string();
224+ let label = text.clone();
225+ hitmap::dynamic(move || (format!("card.{id}"), label.to_string()), true)
226+ });
204 div()227 div()
205- .id(id.into())228+ .id(id)
206 .flex_1()229 .flex_1()
207 .flex()230 .flex()
208 .h(px(CONTROL_H))231 .h(px(CONTROL_H))
@@ -214,6 +237,7 @@ fn dark_ghost_button(
214 .cursor_pointer()237 .cursor_pointer()
215 .hover(|s| s.bg(rgb(DARK_RAISED())))238 .hover(|s| s.bg(rgb(DARK_RAISED())))
216 .on_click(on_click)239 .on_click(on_click)
240+ .children(hitmap.flatten())
217 .child(241 .child(
218 div()242 div()
219 .type_style(type_scale::label(243 .type_style(type_scale::label(
@@ -221,7 +245,7 @@ fn dark_ghost_button(
221 gpui::FontWeight::MEDIUM,245 gpui::FontWeight::MEDIUM,
222 ))246 ))
223 .text_color(rgb(if active { INK1() } else { INK2() }))247 .text_color(rgb(if active { INK1() } else { INK2() }))
224- .child(text.into()),248+ .child(text),
225 )249 )
226 .when(!chord.is_empty(), |d| {250 .when(!chord.is_empty(), |d| {
227 d.child(251 d.child(
crates/app/src/ui/dock_stance.rsmodified+52 -0
@@ -11,6 +11,7 @@
11 //! still supply the row facts ([`library_rows`], [`source_tint`],11 //! still supply the row facts ([`library_rows`], [`source_tint`],
12 //! [`clip_middle`]...), only the anatomy around them is new.12 //! [`clip_middle`]...), only the anatomy around them is new.
13 13
14+use crate::ui::hitmap;
14 use crate::ui::type_scale::{self, Typeset, head, label, mono};15 use crate::ui::type_scale::{self, Typeset, head, label, mono};
15 use crate::*;16 use crate::*;
16 use gpui::FontWeight;17 use gpui::FontWeight;
@@ -136,6 +137,7 @@ fn ghost_verb(
136 .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1())))137 .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1())))
137 .on_click(on_click)138 .on_click(on_click)
138 })139 })
140+ .children(hitmap::action(action, on))
139 .child(141 .child(
140 div()142 div()
141 .font(label_style.font)143 .font(label_style.font)
@@ -184,6 +186,7 @@ fn dock_tab(
184 save(this.dock_src_active);186 save(this.dock_src_active);
185 cx.notify();187 cx.notify();
186 }))188 }))
189+ .children(hitmap::control(id, label_text, true))
187 .child(190 .child(
188 div()191 div()
189 .font(style.font)192 .font(style.font)
@@ -374,6 +377,10 @@ fn source_row(
374 cx.new(|_| Tip(ghost.clone()))377 cx.new(|_| Tip(ghost.clone()))
375 })378 })
376 })379 })
380+ .children(hitmap::dynamic(
381+ move || (format!("source.{i}.row"), "Source row".into()),
382+ usable,
383+ ))
377 .child(384 .child(
378 div()385 div()
379 .flex()386 .flex()
@@ -463,6 +470,10 @@ fn source_row(
463 },470 },
464 ))471 ))
465 })472 })
473+ .children(hitmap::dynamic(
474+ move || (format!("source.{i}.add"), "Add at playhead".into()),
475+ can_insert,
476+ ))
466 .tooltip(move |_, cx| {477 .tooltip(move |_, cx| {
467 cx.new(|_| {478 cx.new(|_| {
468 Tip(479 Tip(
@@ -508,6 +519,10 @@ fn source_row(
508 cx.stop_propagation();519 cx.stop_propagation();
509 this.toggle_proxy(&proxy_path, proxy_stops, cx);520 this.toggle_proxy(&proxy_path, proxy_stops, cx);
510 }))521 }))
522+ .children(hitmap::dynamic(
523+ move || (format!("source.{i}.proxy"), "Toggle proxy".into()),
524+ !proxy_waiting,
525+ ))
511 .child(526 .child(
512 div()527 div()
513 .font(style.font)528 .font(style.font)
@@ -644,6 +659,15 @@ fn subtitle_palette(player: &Player, cx: &mut Context<Player>) -> Option<AnyElem
644 cx.stop_propagation();659 cx.stop_propagation();
645 this.remove_subtitle_track(track, cx);660 this.remove_subtitle_track(track, cx);
646 }))661 }))
662+ .children(hitmap::dynamic(
663+ move || {
664+ (
665+ format!("subtitle.{track}.remove"),
666+ "Remove subtitle".into(),
667+ )
668+ },
669+ true,
670+ ))
647 .child("×"),671 .child("×"),
648 )672 )
649 })673 })
@@ -671,6 +695,15 @@ fn subtitle_palette(player: &Player, cx: &mut Context<Player>) -> Option<AnyElem
671 }695 }
672 cx.notify();696 cx.notify();
673 }))697 }))
698+ .children(hitmap::dynamic(
699+ move || {
700+ (
701+ format!("subtitle-group.{group_ord}.fold"),
702+ "Toggle subtitle group".into(),
703+ )
704+ },
705+ true,
706+ ))
674 .child(if folded { "▸" } else { "▾" })707 .child(if folded { "▸" } else { "▾" })
675 .when_some(tint, |d, tint| {708 .when_some(tint, |d, tint| {
676 d.child(709 d.child(
@@ -798,6 +831,7 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
798 this.dock_filter_edit = true;831 this.dock_filter_edit = true;
799 cx.notify();832 cx.notify();
800 }))833 }))
834+ .children(hitmap::control("dock.filter", "Filter sources", true))
801 .child(match player.dock_filter.is_empty() {835 .child(match player.dock_filter.is_empty() {
802 true => "⌕ type to filter — name, codec, unused…".to_string(),836 true => "⌕ type to filter — name, codec, unused…".to_string(),
803 false => format!("⌕ {filter_text}"),837 false => format!("⌕ {filter_text}"),
@@ -827,6 +861,15 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
827 this.library_tab = tab;861 this.library_tab = tab;
828 cx.notify();862 cx.notify();
829 }))863 }))
864+ .children(hitmap::dynamic(
865+ move || {
866+ (
867+ format!("dock.filter.{}", tab.label()),
868+ format!("Filter {}", tab.label()),
869+ )
870+ },
871+ true,
872+ ))
830 .child(tab.label())873 .child(tab.label())
831 })),874 })),
832 )875 )
@@ -854,6 +897,15 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
854 this.dock_sort = sort;897 this.dock_sort = sort;
855 cx.notify();898 cx.notify();
856 }))899 }))
900+ .children(hitmap::dynamic(
901+ move || {
902+ (
903+ format!("dock.sort.{}", sort.label()),
904+ format!("Sort {}", sort.label()),
905+ )
906+ },
907+ true,
908+ ))
857 .child(sort.label())909 .child(sort.label())
858 })),910 })),
859 )911 )
crates/app/src/ui/hitmap.rsadded+163 -0
@@ -0,0 +1,163 @@
1+//! Machine-readable bounds for the Darkroom's pointer controls.
2+use crate::ActionId;
3+
4+use gpui::*;
5+use std::{
6+ cell::RefCell,
7+ fmt::Write as _,
8+ fs,
9+ path::{Path, PathBuf},
10+ sync::LazyLock,
11+ time::{Duration, Instant},
12+};
13+
14+const WRITE_INTERVAL: Duration = Duration::from_millis(250);
15+
16+struct Target {
17+ id: String,
18+ label: String,
19+ bounds: Bounds<Pixels>,
20+ enabled: bool,
21+}
22+
23+#[derive(Default)]
24+struct State {
25+ targets: Vec<Target>,
26+ last_write: Option<Instant>,
27+}
28+
29+thread_local! {
30+ static STATE: RefCell<State> = RefCell::new(State::default());
31+}
32+
33+fn output_path() -> Option<&'static Path> {
34+ static PATH: LazyLock<Option<PathBuf>> =
35+ LazyLock::new(|| std::env::var_os("EDITH_HITMAP").map(PathBuf::from));
36+ PATH.as_deref()
37+}
38+pub(crate) fn enabled() -> bool {
39+ output_path().is_some()
40+}
41+
42+/// Clears the current-frame controls before descendants record their laid-out
43+/// bounds, then writes the completed frame after all descendants prepaint.
44+pub(crate) fn frame() -> Option<impl IntoElement> {
45+ output_path()?;
46+ Some(
47+ canvas(
48+ |_, _, _| STATE.with(|state| state.borrow_mut().targets.clear()),
49+ |_, _, _, _| flush(),
50+ )
51+ .absolute()
52+ .size_full(),
53+ )
54+}
55+
56+/// An invisible child that records a control's final window-relative bounds.
57+pub(crate) fn control(
58+ id: &'static str,
59+ label: &'static str,
60+ enabled: bool,
61+) -> Option<impl IntoElement> {
62+ dynamic(|| (id.into(), label.into()), enabled)
63+}
64+
65+/// Dynamic controls defer identifier allocation until instrumentation is on.
66+pub(crate) fn dynamic(
67+ target: impl FnOnce() -> (String, String),
68+ enabled: bool,
69+) -> Option<impl IntoElement> {
70+ output_path()?;
71+ let (id, label) = target();
72+ Some(
73+ canvas(
74+ move |bounds, _, _| {
75+ STATE.with(|state| {
76+ state.borrow_mut().targets.push(Target {
77+ id,
78+ label,
79+ bounds,
80+ enabled,
81+ });
82+ });
83+ },
84+ |_, _, _, _| (),
85+ )
86+ .absolute()
87+ .size_full(),
88+ )
89+}
90+
91+fn flush() {
92+ let Some(path) = output_path() else {
93+ return;
94+ };
95+ let now = Instant::now();
96+ let body = STATE.with(|state| {
97+ let mut state = state.borrow_mut();
98+ if state
99+ .last_write
100+ .is_some_and(|last| now.duration_since(last) < WRITE_INTERVAL)
101+ {
102+ return None;
103+ }
104+ state.last_write = Some(now);
105+ let mut json = String::from("[");
106+ for (i, target) in state.targets.iter().enumerate() {
107+ if i != 0 {
108+ json.push(',');
109+ }
110+ json.push_str("{\"id\":");
111+ json_string(&mut json, &target.id);
112+ json.push_str(",\"label\":");
113+ json_string(&mut json, &target.label);
114+ let bounds = target.bounds;
115+ let _ = write!(
116+ json,
117+ ",\"x\":{},\"y\":{},\"w\":{},\"h\":{},\"enabled\":{}",
118+ f32::from(bounds.origin.x),
119+ f32::from(bounds.origin.y),
120+ f32::from(bounds.size.width),
121+ f32::from(bounds.size.height),
122+ target.enabled,
123+ );
124+ json.push('}');
125+ }
126+ json.push(']');
127+ Some(json)
128+ });
129+ let Some(body) = body else {
130+ return;
131+ };
132+ let temp = path.with_extension(format!("hitmap-{}.tmp", std::process::id()));
133+ if fs::write(&temp, body).is_ok() {
134+ let _ = fs::rename(temp, path);
135+ }
136+}
137+
138+fn json_string(json: &mut String, value: &str) {
139+ json.push('"');
140+ for c in value.chars() {
141+ match c {
142+ '"' => json.push_str("\\\""),
143+ '\\' => json.push_str("\\\\"),
144+ '\n' => json.push_str("\\n"),
145+ '\r' => json.push_str("\\r"),
146+ '\t' => json.push_str("\\t"),
147+ c if c <= '\u{1f}' => {
148+ let _ = write!(json, "\\u{:04x}", c as u32);
149+ }
150+ c => json.push(c),
151+ }
152+ }
153+ json.push('"');
154+}
155+
156+pub(crate) fn action_id(action: ActionId) -> String {
157+ format!("action.{action:?}")
158+}
159+
160+/// Records an action control under the action name it dispatches.
161+pub(crate) fn action(action: ActionId, enabled: bool) -> Option<impl IntoElement> {
162+ dynamic(move || (action_id(action), action.label().into()), enabled)
163+}
crates/app/src/ui/mod.rsmodified+1 -0
@@ -6,6 +6,7 @@
6 pub mod bench_stance;6 pub mod bench_stance;
7 pub mod cards;7 pub mod cards;
8 pub mod dock_stance;8 pub mod dock_stance;
9+pub mod hitmap;
9 pub mod inspector;10 pub mod inspector;
10 pub mod library;11 pub mod library;
11 pub mod overlays;12 pub mod overlays;
crates/app/src/ui/overlays.rsmodified+6 -0
@@ -1,5 +1,6 @@
1 //! The bars and the floating cards that are not inspector sections.1 //! The bars and the floating cards that are not inspector sections.
2 2
3+use crate::ui::hitmap;
3 use crate::ui::stance::menu_floor;4 use crate::ui::stance::menu_floor;
4 use crate::ui::type_scale::{self, Typeset};5 use crate::ui::type_scale::{self, Typeset};
5 use crate::ui::widgets::*;6 use crate::ui::widgets::*;
@@ -695,6 +696,7 @@ impl Player {
695 },696 },
696 ))697 ))
697 })698 })
699+ .children(hitmap::action(action, enabled))
698 .into_any_element(),700 .into_any_element(),
699 );701 );
700 }702 }
@@ -903,6 +905,10 @@ impl Player {
903 .on_click(905 .on_click(
904 cx.listener(move |this, _: &ClickEvent, _, cx| this.choose(choice, cx)),906 cx.listener(move |this, _: &ClickEvent, _, cx| this.choose(choice, cx)),
905 )907 )
908+ .children(hitmap::dynamic(
909+ move || (format!("picker.choice.{n}"), "Choose setting value".into()),
910+ true,
911+ ))
906 .into_any_element()912 .into_any_element()
907 })913 })
908 .collect();914 .collect();
crates/app/src/ui/settings_stance.rsmodified+2 -0
@@ -32,6 +32,7 @@
32 //! since nothing in [`engine::project::Project`] holds a place to persist an32 //! since nothing in [`engine::project::Project`] holds a place to persist an
33 //! override into.33 //! override into.
34 34
35+use crate::ui::hitmap;
35 use crate::ui::type_scale;36 use crate::ui::type_scale;
36 use crate::*;37 use crate::*;
37 use engine::colorspace::ContentLight;38 use engine::colorspace::ContentLight;
@@ -147,6 +148,7 @@ fn row_full(
147 .hover(|s| s.bg(rgb(DARK_RAISED())))148 .hover(|s| s.bg(rgb(DARK_RAISED())))
148 .on_click(on_click)149 .on_click(on_click)
149 })150 })
151+ .children(hitmap::control(id, label_text, !exporting))
150 .child(152 .child(
151 div()153 div()
152 .font(label_style.font)154 .font(label_style.font)
crates/app/src/ui/spine_stance.rsmodified+3 -0
@@ -4,6 +4,7 @@
4 //! drew. `stance.rs::spine()` keeps the panel frame (width, surface,4 //! drew. `stance.rs::spine()` keeps the panel frame (width, surface,
5 //! border); this module owns the rows inside it.5 //! border); this module owns the rows inside it.
6 6
7+use crate::ui::hitmap;
7 use crate::ui::type_scale::{self, Typeset};8 use crate::ui::type_scale::{self, Typeset};
8 use crate::*;9 use crate::*;
9 10
@@ -81,6 +82,7 @@ fn glyph(
81 }),82 }),
82 )83 )
83 })84 })
85+ .children(hitmap::action(action, on))
84 .child(86 .child(
85 div()87 div()
86 .line_height(relative(1.05))88 .line_height(relative(1.05))
@@ -141,6 +143,7 @@ fn trim_control(active: bool, player: &Player, cx: &mut Context<Player>) -> impl
141 this.act(action, window, cx)143 this.act(action, window, cx)
142 }))144 }))
143 })145 })
146+ .children(hitmap::action(action, on))
144 .child(147 .child(
145 div()148 div()
146 .line_height(relative(1.05))149 .line_height(relative(1.05))
crates/app/src/ui/stance.rsmodified+2 -0
@@ -10,6 +10,7 @@
10 10
11 use crate::ui::bench_stance;11 use crate::ui::bench_stance;
12 use crate::ui::dock_stance;12 use crate::ui::dock_stance;
13+use crate::ui::hitmap;
13 use crate::ui::settings_stance;14 use crate::ui::settings_stance;
14 use crate::ui::spine_stance;15 use crate::ui::spine_stance;
15 use crate::ui::timeband_stance;16 use crate::ui::timeband_stance;
@@ -959,6 +960,7 @@ pub(crate) fn render(
959 .size_full()960 .size_full()
960 .flex()961 .flex()
961 .bg(rgb(DARK_CANVAS()))962 .bg(rgb(DARK_CANVAS()))
963+ .children(hitmap::frame())
962 .child(mouse_exit_listener(cx))964 .child(mouse_exit_listener(cx))
963 .child(spine(player, cx))965 .child(spine(player, cx))
964 .child(966 .child(
crates/app/src/ui/timeband_stance.rsmodified+17 -0
@@ -8,6 +8,7 @@
8 //! close to the mock's ~20px reading. Every size in this module comes from8 //! close to the mock's ~20px reading. Every size in this module comes from
9 //! `ui::type_scale` (role, not a bare `px()` literal).9 //! `ui::type_scale` (role, not a bare `px()` literal).
10 10
11+use crate::ui::hitmap;
11 use crate::ui::type_scale::{self, label, mono};12 use crate::ui::type_scale::{self, label, mono};
12 use crate::*;13 use crate::*;
13 use gpui::FontWeight;14 use gpui::FontWeight;
@@ -70,6 +71,7 @@ fn ghost(
70 .on_click(cx.listener(move |this, _: &ClickEvent, window, cx| {71 .on_click(cx.listener(move |this, _: &ClickEvent, window, cx| {
71 this.act(action, window, cx);72 this.act(action, window, cx);
72 }))73 }))
74+ .children(hitmap::action(action, player.enable(action, None).yes()))
73 .font(glyph_style.font)75 .font(glyph_style.font)
74 .text_size(glyph_style.size)76 .text_size(glyph_style.size)
75 .text_color(rgb(if active { INK1() } else { INK2() }))77 .text_color(rgb(if active { INK1() } else { INK2() }))
@@ -351,6 +353,7 @@ fn contact_strip(player: &Player, position: f64, cx: &mut Context<Player>) -> im
351 MouseButton::Left,353 MouseButton::Left,
352 cx.listener(|_, _, _, _| PAN_ANCHOR.with(|a| a.set(None))),354 cx.listener(|_, _, _, _| PAN_ANCHOR.with(|a| a.set(None))),
353 )355 )
356+ .children(hitmap::control("timeline.contact-strip", "Timeline contact strip", true))
354 .child(bounds_probe(strip_bounds))357 .child(bounds_probe(strip_bounds))
355 // Baseline: a quiet hairline under the real traces below it, so an358 // Baseline: a quiet hairline under the real traces below it, so an
356 // audio-free stretch of film still reads as film rather than gap.359 // audio-free stretch of film still reads as film rather than gap.
@@ -456,6 +459,7 @@ fn grip(id: &'static str, left: bool, top: bool) -> impl IntoElement {
456 PAN_ANCHOR.with(|a| a.set(Some(f32::from(event.position.x))));459 PAN_ANCHOR.with(|a| a.set(Some(f32::from(event.position.x))));
457 cx.stop_propagation();460 cx.stop_propagation();
458 })461 })
462+ .children(hitmap::control(id, "Timeline viewport grip", true))
459 }463 }
460 464
461 /// The Export chip (MOCK-SPEC "Export chip", DESIGN §4): the room's single465 /// The Export chip (MOCK-SPEC "Export chip", DESIGN §4): the room's single
@@ -494,6 +498,14 @@ fn export_chip(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
494 }498 }
495 cx.notify();499 cx.notify();
496 }))500 }))
501+ .children(hitmap::action(
502+ if exporting {
503+ ActionId::CancelExport
504+ } else {
505+ ActionId::Export
506+ },
507+ true,
508+ ))
497 .child(509 .child(
498 div()510 div()
499 .font(label_style.font)511 .font(label_style.font)
@@ -541,6 +553,7 @@ fn volume_slider(player: &Player, cx: &mut Context<Player>) -> impl IntoElement
541 )553 )
542 .child(bounds_probe(player.volume_bar.clone()))554 .child(bounds_probe(player.volume_bar.clone()))
543 })555 })
556+ .children(hitmap::control("timeline.volume", "Volume", enabled))
544 .child(557 .child(
545 div()558 div()
546 .w_full()559 .w_full()
@@ -771,6 +784,10 @@ fn save_verb(player: &Player, cx: &mut Context<Player>) -> impl IntoElement {
771 .on_click(cx.listener(|this, _: &ClickEvent, window, cx| {784 .on_click(cx.listener(|this, _: &ClickEvent, window, cx| {
772 this.act(ActionId::Save, window, cx);785 this.act(ActionId::Save, window, cx);
773 }))786 }))
787+ .children(hitmap::action(
788+ ActionId::Save,
789+ player.enable(ActionId::Save, None).yes(),
790+ ))
774 .child(791 .child(
775 div()792 div()
776 .font(label_style.font)793 .font(label_style.font)