Merge branch 'worktree-agent-affb4c7e59794b1eb'
Browse files at this commit2 changed files +344 -46
- crates/app/src/tests/layout.rs +154 -0
- crates/app/src/ui/timeband_stance.rs +190 -46
crates/app/src/tests/layout.rsmodified+154 -0
| @@ -3055,3 +3055,157 @@ fn the_ruler_plate_shows_the_timecode_only_while_a_scrub_is_live() { | |||
| 3055 | "the ticks still lose the plate's width at rest" | 3055 | "the ticks still lose the plate's width at rest" |
| 3056 | ); | 3056 | ); |
| 3057 | } | 3057 | } |
| 3058 | + | ||
| 3059 | + | ||
| 3060 | +/// The band overflowed its own column at 1280x720 (`$EDITH_HITMAP`: | ||
| 3061 | +/// `action.Export x=1113 w=80` with the column ending at x=995, the contact | ||
| 3062 | +/// strip measured `w=0`), so the Export chip was invisible under the dock and | ||
| 3063 | +/// a click on blank dock space at (1130,435) opened the export card. Three | ||
| 3064 | +/// things hold that shut: the row clips itself, the strip keeps a floor, and | ||
| 3065 | +/// the ladder sheds groups above it. | ||
| 3066 | +#[test] | ||
| 3067 | +fn the_time_band_never_paints_outside_its_own_column() { | ||
| 3068 | + let src = src_text("ui/timeband_stance.rs"); | ||
| 3069 | + let start = src.find(r#".id("stance-time-band-row")"#).expect("the band row"); | ||
| 3070 | + let row = &src[start..start + src[start..].find(".child(hero_timecode(").expect("the timecode")]; | ||
| 3071 | + assert!( | ||
| 3072 | + row.contains(".overflow_hidden()"), | ||
| 3073 | + "the band row lets its children paint (and be clicked) under the dock: {row}" | ||
| 3074 | + ); | ||
| 3075 | + assert!( | ||
| 3076 | + src.contains(".min_w(px(STRIP_MIN_W))"), | ||
| 3077 | + "the contact strip is the flex_1 that absorbs the slack; without a floor it measures 0" | ||
| 3078 | + ); | ||
| 3079 | + assert!(crate::ui::timeband_stance::STRIP_MIN_W >= 120.); | ||
| 3080 | +} | ||
| 3081 | + | ||
| 3082 | +/// DESIGN §7's ladder, one layer per threshold: the four things the band is | ||
| 3083 | +/// *for* -- timecode, cut readout, contact strip, Export -- survive every | ||
| 3084 | +/// rung, and the sheddable groups go in a fixed order (chords, then the | ||
| 3085 | +/// monitoring cluster, then sync/loop, then the range marks), never all at | ||
| 3086 | +/// once. Thresholds are the measured group widths; this pins their order and | ||
| 3087 | +/// the 1280x720 column (939px measured, spine 56 + dock 285) landing on the | ||
| 3088 | +/// marks-only rung, which is what makes Export fit there (it ended at x=991 | ||
| 3089 | +/// inside a column ending at 995, against x=1113 under the dock before). | ||
| 3090 | +#[test] | ||
| 3091 | +fn the_band_sheds_one_layer_per_threshold_in_a_fixed_order() { | ||
| 3092 | + use crate::ui::timeband_stance::band_layers; | ||
| 3093 | + let ladder = [2000., 1300., 1100., 939., 800., 0.] | ||
| 3094 | + .map(|w| band_layers(w)) | ||
| 3095 | + .map(|l| (l.chords, l.volume, l.sync, l.marks)); | ||
| 3096 | + assert_eq!( | ||
| 3097 | + ladder, | ||
| 3098 | + [ | ||
| 3099 | + (true, true, true, true), | ||
| 3100 | + (false, true, true, true), | ||
| 3101 | + (false, false, true, true), | ||
| 3102 | + (false, false, false, true), | ||
| 3103 | + (false, false, false, false), | ||
| 3104 | + (false, false, false, false), | ||
| 3105 | + ], | ||
| 3106 | + "the band must drop chords, then the monitoring cluster, then sync/loop, then the marks" | ||
| 3107 | + ); | ||
| 3108 | + // Monotone: a wider band never shows less than a narrower one. | ||
| 3109 | + let mut prev = band_layers(0.); | ||
| 3110 | + for w in (0..2400).step_by(10).map(|w| w as f32) { | ||
| 3111 | + let now = band_layers(w); | ||
| 3112 | + for (a, b) in [ | ||
| 3113 | + (prev.chords, now.chords), | ||
| 3114 | + (prev.volume, now.volume), | ||
| 3115 | + (prev.sync, now.sync), | ||
| 3116 | + (prev.marks, now.marks), | ||
| 3117 | + ] { | ||
| 3118 | + assert!(b || !a, "layer came back off at {w}px"); | ||
| 3119 | + } | ||
| 3120 | + prev = now; | ||
| 3121 | + } | ||
| 3122 | +} | ||
| 3123 | + | ||
| 3124 | +/// Every door in this band is at least `HIT_MIN` wide and tall (WCAG 2.5.8). | ||
| 3125 | +/// The hitmap read `SetIn w=8`, `VolumeDown w=12`, `Loop w=13`, `SetOut w=15`, | ||
| 3126 | +/// `Prev/NextSyncPoint w=16` before this: padding on the shared `ghost`, not a | ||
| 3127 | +/// bigger glyph. | ||
| 3128 | +#[test] | ||
| 3129 | +fn every_ghost_in_the_time_band_carries_a_full_hit_area() { | ||
| 3130 | + let src = src_text("ui/timeband_stance.rs"); | ||
| 3131 | + let start = src.find("fn ghost(").expect("the band's ghost"); | ||
| 3132 | + let ghost = &src[start..start + src[start..].find(".child(glyph.into())").expect("its glyph")]; | ||
| 3133 | + for needle in [".min_w(px(HIT_MIN))", ".min_h(px(HIT_MIN))"] { | ||
| 3134 | + assert!(ghost.contains(needle), "the band's ghost lost {needle}: {ghost}"); | ||
| 3135 | + } | ||
| 3136 | + assert!(HIT_MIN >= 24.); | ||
| 3137 | +} | ||
| 3138 | + | ||
| 3139 | +/// Mute wore `"{volume}%"` as its glyph while the slider beside it drew the | ||
| 3140 | +/// same value: one number, two places, and a toggle with no verb of its own. | ||
| 3141 | +/// The level is a mono readout beside the slider now, once. | ||
| 3142 | +#[test] | ||
| 3143 | +fn the_level_is_written_once_and_mute_wears_a_glyph() { | ||
| 3144 | + let src = src_text("ui/timeband_stance.rs"); | ||
| 3145 | + assert_eq!( | ||
| 3146 | + src.matches(r#"player.volume.percent()"#).count(), | ||
| 3147 | + 1, | ||
| 3148 | + "the volume level must be written in exactly one place in the band" | ||
| 3149 | + ); | ||
| 3150 | + assert!( | ||
| 3151 | + src.contains(r#"if player.volume.muted { "◁×" } else { "◁))" }"#), | ||
| 3152 | + "mute must wear a speaker glyph, struck when muted" | ||
| 3153 | + ); | ||
| 3154 | + assert!(src.contains("fn volume_readout("), "the level readout is the one place it is written"); | ||
| 3155 | +} | ||
| 3156 | + | ||
| 3157 | +/// `Play` and `StepForward` drew the same solid right-triangle: two verbs one | ||
| 3158 | +/// shape, told apart only by their chords. Step wears the frame-step pair. | ||
| 3159 | +#[test] | ||
| 3160 | +fn transport_verbs_differ_by_shape_not_only_by_chord() { | ||
| 3161 | + let src = src_text("ui/timeband_stance.rs"); | ||
| 3162 | + let glyph = |action: &str| { | ||
| 3163 | + let at = src.find(&format!("ActionId::{action},")).expect("the call"); | ||
| 3164 | + src[..at].rsplit('"').nth(1).expect("its glyph").to_string() | ||
| 3165 | + }; | ||
| 3166 | + let shapes = ["Play", "StepBack", "StepForward", "JumpBack", "JumpForward"].map(glyph); | ||
| 3167 | + let mut seen = shapes.to_vec(); | ||
| 3168 | + seen.sort(); | ||
| 3169 | + seen.dedup(); | ||
| 3170 | + assert_eq!(seen.len(), shapes.len(), "two transport verbs share one glyph: {shapes:?}"); | ||
| 3171 | +} | ||
| 3172 | + | ||
| 3173 | +/// DESIGN §6: "the cut readout is the odometer". Keyed off the selection it | ||
| 3174 | +/// read `cut —/—` immediately after a split -- two clips on the bench, the | ||
| 3175 | +/// playhead resting on the new cut, nothing picked. It reads the playhead | ||
| 3176 | +/// now: the cut under it, else the next one ahead, else the selection. | ||
| 3177 | +#[test] | ||
| 3178 | +fn the_cut_readout_counts_from_the_playhead() { | ||
| 3179 | + use crate::ui::timeband_stance::odometer_cut; | ||
| 3180 | + let at = |start: u32, len: u32| Clip { | ||
| 3181 | + fade_in: 0, | ||
| 3182 | + fade_out: 0, | ||
| 3183 | + transition_out: 0, | ||
| 3184 | + start, | ||
| 3185 | + in_frame: 0, | ||
| 3186 | + out_frame: len, | ||
| 3187 | + source: 0, | ||
| 3188 | + link: None, | ||
| 3189 | + eq: None, | ||
| 3190 | + color: None, | ||
| 3191 | + transform: None, | ||
| 3192 | + fit: FitPolicy::Fit, | ||
| 3193 | + speed: Speed::NORMAL, | ||
| 3194 | + }; | ||
| 3195 | + let lane = [at(0, 30), at(30, 30)]; | ||
| 3196 | + assert_eq!(odometer_cut(&lane, 0), Some(0)); | ||
| 3197 | + assert_eq!(odometer_cut(&lane, 29), Some(0)); | ||
| 3198 | + // The split's own frame: the playhead rests on the SECOND cut's head. | ||
| 3199 | + assert_eq!(odometer_cut(&lane, 30), Some(1)); | ||
| 3200 | + assert_eq!(odometer_cut(&lane, 59), Some(1)); | ||
| 3201 | + // Past the last cut there is nothing to count -- the selection answers. | ||
| 3202 | + assert_eq!(odometer_cut(&lane, 60), None); | ||
| 3203 | + // In a gap: the next cut ahead of the playhead. | ||
| 3204 | + let gapped = [at(0, 10), at(40, 10)]; | ||
| 3205 | + assert_eq!(odometer_cut(&gapped, 20), Some(1)); | ||
| 3206 | + assert_eq!(odometer_cut(&[], 0), None); | ||
| 3207 | + assert!( | ||
| 3208 | + src_text("ui/timeband_stance.rs").contains("odometer_cut(s.lane_clips(lane), frame)"), | ||
| 3209 | + "the readout must derive its odometer from the playhead" | ||
| 3210 | + ); | ||
| 3211 | +} | ||
crates/app/src/ui/timeband_stance.rsmodified+190 -46
| @@ -23,6 +23,92 @@ thread_local! { | |||
| 23 | // fold both into `Player` once `main.rs` is free again. | 23 | // fold both into `Player` once `main.rs` is free again. |
| 24 | static STRIP_BOUNDS: Rc<Cell<Bounds<Pixels>>> = Rc::new(Cell::new(Bounds::default())); | 24 | static STRIP_BOUNDS: Rc<Cell<Bounds<Pixels>>> = Rc::new(Cell::new(Bounds::default())); |
| 25 | static PAN_ANCHOR: Cell<Option<f32>> = Cell::new(None); | 25 | static PAN_ANCHOR: Cell<Option<f32>> = Cell::new(None); |
| 26 | + /// The band row's own measured width, read by the frame after the one | ||
| 27 | + /// that took it (`width_probe` asks for that frame whenever it changes). | ||
| 28 | + /// This is what the degradation ladder below keys off: the band cannot | ||
| 29 | + /// know its column's width any other way without a `Window` this | ||
| 30 | + /// module's `render` is not handed. | ||
| 31 | + static BAND_W: Rc<Cell<Pixels>> = Rc::new(Cell::new(px(0.))); | ||
| 32 | + /// Set once per `render` from the ladder, read by `ghost` (which the | ||
| 33 | + /// band's own helpers call three levels down) -- a render-scoped | ||
| 34 | + /// constant rather than a parameter threaded through every call site. | ||
| 35 | + static SHOW_CHORDS: Cell<bool> = const { Cell::new(true) }; | ||
| 36 | +} | ||
| 37 | + | ||
| 38 | +/// The contact strip's floor: the flex_1 element absorbs the band's slack, | ||
| 39 | +/// but a minimap narrower than this is not a map. | ||
| 40 | +pub(crate) const STRIP_MIN_W: f32 = 120.; | ||
| 41 | + | ||
| 42 | +/// The band's own width probe, `timeline_math::height_probe`'s shape on the | ||
| 43 | +/// other axis: a measurement is read by the frame after the one that took it, | ||
| 44 | +/// so a change has to ask for that frame or a resize would leave the ladder | ||
| 45 | +/// one layer behind until something else happened to draw. | ||
| 46 | +fn width_probe(into: Rc<Cell<Pixels>>) -> impl IntoElement { | ||
| 47 | + canvas( | ||
| 48 | + move |bounds, window, _| { | ||
| 49 | + // Only on a change: an unconditional request is a repaint loop. | ||
| 50 | + if into.replace(bounds.size.width) != bounds.size.width { | ||
| 51 | + window.request_animation_frame(); | ||
| 52 | + } | ||
| 53 | + }, | ||
| 54 | + |_, _, _, _| (), | ||
| 55 | + ) | ||
| 56 | + .absolute() | ||
| 57 | + .size_full() | ||
| 58 | +} | ||
| 59 | + | ||
| 60 | +/// Which layers of the band are still drawn at a given column width | ||
| 61 | +/// (DESIGN §7's ladder, one layer per threshold, never all at once). | ||
| 62 | +#[derive(Clone, Copy, PartialEq, Eq, Debug)] | ||
| 63 | +pub(crate) struct BandLayers { | ||
| 64 | + /// Chord badges under the transport glyphs. | ||
| 65 | + pub(crate) chords: bool, | ||
| 66 | + /// The audio-monitoring cluster (mute, -/+, slider, level readout). | ||
| 67 | + pub(crate) volume: bool, | ||
| 68 | + /// The sync-point pair and the loop toggle. | ||
| 69 | + pub(crate) sync: bool, | ||
| 70 | + /// The export-range marks (I / O / x). | ||
| 71 | + pub(crate) marks: bool, | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +/// The ladder itself. Every threshold is a MEASURED number: the band drawn | ||
| 75 | +/// whole at 2560x1440 (`$EDITH_HITMAP`) reads 1246px of fixed groups beside a | ||
| 76 | +/// 974px strip, and the same band at 1280x720 (chords off) reads each glyph's | ||
| 77 | +/// door at its `HIT_MIN` floor. Fixed width + `STRIP_MIN_W`, rounded up to the | ||
| 78 | +/// next 10px, is what each rung costs: | ||
| 79 | +/// | ||
| 80 | +/// | drawn | fixed | needs | | ||
| 81 | +/// |----------------------------------------------|-------|--------| | ||
| 82 | +/// | everything, chords under every glyph | 1246 | 1370px | | ||
| 83 | +/// | chords dropped (-97px, doors keep `HIT_MIN`) | 1149 | 1270px | | ||
| 84 | +/// | + monitoring cluster dropped (-256px) | 893 | 1020px | | ||
| 85 | +/// | + sync pair and loop dropped (-102px) | 791 | 920px | | ||
| 86 | +/// | + range marks dropped (-92px): the floor | 699 | 820px | | ||
| 87 | +/// | ||
| 88 | +/// The four things the band is *for* -- timecode, cut readout, contact strip | ||
| 89 | +/// (>=`STRIP_MIN_W`, the flex_1 that absorbs the slack) and the Export chip -- | ||
| 90 | +/// are on every rung; below the floor's own 820px there is nothing left to | ||
| 91 | +/// shed and `overflow_hidden` is what keeps the rest inside the column. | ||
| 92 | +/// There is no zoom group in this band (the charter's rung 2): the monitoring | ||
| 93 | +/// cluster is the band's equivalent extra and takes its place. | ||
| 94 | +pub(crate) fn band_layers(band_w: f32) -> BandLayers { | ||
| 95 | + BandLayers { | ||
| 96 | + chords: band_w >= 1370., | ||
| 97 | + volume: band_w >= 1270., | ||
| 98 | + sync: band_w >= 1020., | ||
| 99 | + marks: band_w >= 920., | ||
| 100 | + } | ||
| 101 | +} | ||
| 102 | + | ||
| 103 | +/// The odometer's cut (DESIGN §6, "the cut readout is the odometer"): the cut | ||
| 104 | +/// the playhead rests on, or -- when it rests in a gap -- the next one ahead | ||
| 105 | +/// of it. `None` only when there is no cut at or after the playhead, which is | ||
| 106 | +/// when the caller falls back to the selection. | ||
| 107 | +pub(crate) fn odometer_cut(clips: &[Clip], frame: u32) -> Option<usize> { | ||
| 108 | + clips | ||
| 109 | + .iter() | ||
| 110 | + .position(|c| frame >= c.start && frame < c.end()) | ||
| 111 | + .or_else(|| clips.iter().position(|c| c.start > frame)) | ||
| 26 | } | 112 | } |
| 27 | 113 | ||
| 28 | /// A stacked ghost command (DESIGN §4, MOCK-SPEC "Ghost transport"/"spine"): | 114 | /// A stacked ghost command (DESIGN §4, MOCK-SPEC "Ghost transport"/"spine"): |
| @@ -66,6 +152,13 @@ fn ghost( | |||
| 66 | .flex() | 152 | .flex() |
| 67 | .flex_col() | 153 | .flex_col() |
| 68 | .items_center() | 154 | .items_center() |
| 155 | + .justify_center() | ||
| 156 | + // WCAG 2.5.8, the same `HIT_MIN` floor `interact.rs` holds clip edges | ||
| 157 | + // to: a glyph may be 8px wide, its door may not. Padding only -- | ||
| 158 | + // glyph sizes and the groups' own gaps are untouched. | ||
| 159 | + .min_w(px(HIT_MIN)) | ||
| 160 | + .min_h(px(HIT_MIN)) | ||
| 161 | + .px(px(2.)) | ||
| 69 | .gap(px(1.)) | 162 | .gap(px(1.)) |
| 70 | .cursor_pointer() | 163 | .cursor_pointer() |
| 71 | .on_click(cx.listener(move |this, _: &ClickEvent, window, cx| { | 164 | .on_click(cx.listener(move |this, _: &ClickEvent, window, cx| { |
| @@ -76,13 +169,16 @@ fn ghost( | |||
| 76 | .text_size(glyph_style.size) | 169 | .text_size(glyph_style.size) |
| 77 | .text_color(rgb(if active { INK1() } else { INK2() })) | 170 | .text_color(rgb(if active { INK1() } else { INK2() })) |
| 78 | .child(glyph.into()) | 171 | .child(glyph.into()) |
| 79 | - .child( | 172 | + .when(SHOW_CHORDS.with(Cell::get), |el| { |
| 80 | - div() | 173 | + el.child( |
| 81 | - .font(chord_style.font) | 174 | + div() |
| 82 | - .text_size(chord_style.size) | 175 | + .flex_none() |
| 83 | - .text_color(rgb(INK3())) | 176 | + .font(chord_style.font) |
| 84 | - .child(player.keymap.chord(action)), | 177 | + .text_size(chord_style.size) |
| 85 | - ) | 178 | + .text_color(rgb(INK3())) |
| 179 | + .child(player.keymap.chord(action)), | ||
| 180 | + ) | ||
| 181 | + }) | ||
| 86 | } | 182 | } |
| 87 | 183 | ||
| 88 | /// The hero timecode, digits `ink1` and colons `ink3` (DESIGN §3, MOCK-SPEC | 184 | /// The hero timecode, digits `ink1` and colons `ink3` (DESIGN §3, MOCK-SPEC |
| @@ -114,11 +210,24 @@ fn signed_delta(frames: i64, fps: f64) -> String { | |||
| 114 | /// the subject cut's own trim deltas against where roll armed it (only real | 210 | /// the subject cut's own trim deltas against where roll armed it (only real |
| 115 | /// once [`Player::loop_trim`] has a baseline to measure against), and the | 211 | /// once [`Player::loop_trim`] has a baseline to measure against), and the |
| 116 | /// roll word itself, on or dim. `·` separators in `ink3`, values in `ink2`. | 212 | /// roll word itself, on or dim. `·` separators in `ink3`, values in `ink2`. |
| 117 | -fn cut_readout(player: &Player) -> impl IntoElement { | 213 | +fn cut_readout(player: &Player, position: f64) -> impl IntoElement { |
| 118 | let sep = || div().text_color(rgb(INK3())).child(" · "); | 214 | let sep = || div().text_color(rgb(INK3())).child(" · "); |
| 119 | let val = |s: String| div().text_color(rgb(INK2())).child(s); | 215 | let val = |s: String| div().text_color(rgb(INK2())).child(s); |
| 120 | let anchor = player.selected.anchor(); | 216 | let anchor = player.selected.anchor(); |
| 121 | - let odometer = anchor | 217 | + // The odometer reads the PLAYHEAD, not the selection (DESIGN 6): right |
| 218 | + // after a split the two halves are on the bench and nothing is picked, | ||
| 219 | + // and a readout saying `cut -/-` while the playhead sits on the new cut | ||
| 220 | + // is an odometer that stopped turning. The selection only answers when | ||
| 221 | + // the playhead is off every cut on its lane. | ||
| 222 | + let frame = (position * player.active_fps()).max(0.).round() as u32; | ||
| 223 | + let at_playhead = player.session.as_ref().and_then(|s| { | ||
| 224 | + let lane = anchor | ||
| 225 | + .map(|(lane, _)| lane) | ||
| 226 | + .or_else(|| s.lanes().into_iter().find(|l| l.kind == LaneKind::Video))?; | ||
| 227 | + Some((lane, odometer_cut(s.lane_clips(lane), frame)?)) | ||
| 228 | + }); | ||
| 229 | + let odometer = at_playhead | ||
| 230 | + .or(anchor) | ||
| 122 | .and_then(|(lane, idx)| { | 231 | .and_then(|(lane, idx)| { |
| 123 | player | 232 | player |
| 124 | .session | 233 | .session |
| @@ -285,7 +394,10 @@ fn contact_strip(player: &Player, position: f64, cx: &mut Context<Player>) -> im | |||
| 285 | .id("stance-contact-strip") | 394 | .id("stance-contact-strip") |
| 286 | .relative() | 395 | .relative() |
| 287 | .flex_1() | 396 | .flex_1() |
| 288 | - .min_w(px(0.)) | 397 | + // The strip is what absorbs the band's slack, and it measured w=0 at |
| 398 | + // 1280 before this: it holds a floor now and the ladder sheds groups | ||
| 399 | + // above it instead of squeezing the map to nothing. | ||
| 400 | + .min_w(px(STRIP_MIN_W)) | ||
| 289 | .h(px(28.)) | 401 | .h(px(28.)) |
| 290 | .cursor_pointer() | 402 | .cursor_pointer() |
| 291 | .tooltip(|_, cx| { | 403 | .tooltip(|_, cx| { |
| @@ -570,6 +682,20 @@ fn volume_slider(player: &Player, cx: &mut Context<Player>) -> impl IntoElement | |||
| 570 | ) | 682 | ) |
| 571 | } | 683 | } |
| 572 | 684 | ||
| 685 | +/// The level, written once (DESIGN 3: a number about a level is mono). It | ||
| 686 | +/// sits beside the slider that sets it -- the slider's fill and this readout | ||
| 687 | +/// are one truth in two forms, where the mute button used to wear a third. | ||
| 688 | +fn volume_readout(player: &Player) -> impl IntoElement { | ||
| 689 | + let style = mono(type_scale::CHORD_METADATA_MAX_PX, FontWeight::MEDIUM); | ||
| 690 | + div() | ||
| 691 | + .flex_none() | ||
| 692 | + .w(px(34.)) | ||
| 693 | + .font(style.font) | ||
| 694 | + .text_size(style.size) | ||
| 695 | + .text_color(rgb(if player.volume.muted { INK3() } else { INK2() })) | ||
| 696 | + .child(format!("{}%", player.volume.percent())) | ||
| 697 | +} | ||
| 698 | + | ||
| 573 | /// The whole band, left to right per MOCK-SPEC: hero timecode, ghost | 699 | /// The whole band, left to right per MOCK-SPEC: hero timecode, ghost |
| 574 | /// transport, cut readout, the contact strip filling the rest, the Export | 700 | /// transport, cut readout, the contact strip filling the rest, the Export |
| 575 | /// chip at the end. | 701 | /// chip at the end. |
| @@ -579,6 +705,12 @@ pub(crate) fn render( | |||
| 579 | cx: &mut Context<Player>, | 705 | cx: &mut Context<Player>, |
| 580 | ) -> impl IntoElement { | 706 | ) -> impl IntoElement { |
| 581 | let tc = timecode(position, player.active_fps()); | 707 | let tc = timecode(position, player.active_fps()); |
| 708 | + let band_w = BAND_W.with(Rc::clone); | ||
| 709 | + // Layer decision for THIS frame, off the width the last frame measured | ||
| 710 | + // (`width_probe` asks for a frame whenever that width changes, so a | ||
| 711 | + // resize settles in one). | ||
| 712 | + let layers = band_layers(f32::from(band_w.get())); | ||
| 713 | + SHOW_CHORDS.with(|c| c.set(layers.chords)); | ||
| 582 | div() | 714 | div() |
| 583 | .id("stance-time-band-row") | 715 | .id("stance-time-band-row") |
| 584 | // FAULT 1 fix: this div used to be `flex_none`, which sized it to its | 716 | // FAULT 1 fix: this div used to be `flex_none`, which sized it to its |
| @@ -591,8 +723,13 @@ pub(crate) fn render( | |||
| 591 | .h_full() | 723 | .h_full() |
| 592 | .flex() | 724 | .flex() |
| 593 | .items_center() | 725 | .items_center() |
| 594 | - .gap(px(16.)) | 726 | + // Nothing in this band may ever paint (or be clicked) outside its own |
| 727 | + // column again: the Export chip used to land at x=1113 under the | ||
| 728 | + // dock, where a click on blank dock space opened the export card. | ||
| 729 | + .overflow_hidden() | ||
| 730 | + .gap(px(12.)) | ||
| 595 | .px(px(12.)) | 731 | .px(px(12.)) |
| 732 | + .child(width_probe(band_w)) | ||
| 596 | // The most-read element anchors its region (DESIGN §5): the | 733 | // The most-read element anchors its region (DESIGN §5): the |
| 597 | // timecode leads. | 734 | // timecode leads. |
| 598 | .child(hero_timecode(&tc)) | 735 | .child(hero_timecode(&tc)) |
| @@ -647,7 +784,7 @@ pub(crate) fn render( | |||
| 647 | .child(ghost( | 784 | .child(ghost( |
| 648 | "stance-tb-step-back", | 785 | "stance-tb-step-back", |
| 649 | player, | 786 | player, |
| 650 | - "◀", | 787 | + "|◂", |
| 651 | ActionId::StepBack, | 788 | ActionId::StepBack, |
| 652 | false, | 789 | false, |
| 653 | cx, | 790 | cx, |
| @@ -655,7 +792,7 @@ pub(crate) fn render( | |||
| 655 | .child(ghost( | 792 | .child(ghost( |
| 656 | "stance-tb-step-forward", | 793 | "stance-tb-step-forward", |
| 657 | player, | 794 | player, |
| 658 | - "▶", | 795 | + "▸|", |
| 659 | ActionId::StepForward, | 796 | ActionId::StepForward, |
| 660 | false, | 797 | false, |
| 661 | cx, | 798 | cx, |
| @@ -676,36 +813,40 @@ pub(crate) fn render( | |||
| 676 | false, | 813 | false, |
| 677 | cx, | 814 | cx, |
| 678 | )) | 815 | )) |
| 679 | - .child(ghost( | 816 | + .when(layers.sync, |el| { |
| 680 | - "stance-tb-sync-prev", | 817 | + el.child(ghost( |
| 681 | - player, | 818 | + "stance-tb-sync-prev", |
| 682 | - "‹|", | 819 | + player, |
| 683 | - ActionId::PrevSyncPoint, | 820 | + "‹|", |
| 684 | - false, | 821 | + ActionId::PrevSyncPoint, |
| 685 | - cx, | 822 | + false, |
| 686 | - )) | 823 | + cx, |
| 687 | - .child(ghost( | 824 | + )) |
| 688 | - "stance-tb-sync-next", | 825 | + .child(ghost( |
| 689 | - player, | 826 | + "stance-tb-sync-next", |
| 690 | - "|›", | 827 | + player, |
| 691 | - ActionId::NextSyncPoint, | 828 | + "|›", |
| 692 | - false, | 829 | + ActionId::NextSyncPoint, |
| 693 | - cx, | 830 | + false, |
| 694 | - )) | 831 | + cx, |
| 832 | + )) | ||
| 833 | + }) | ||
| 695 | // Loop (homeless per this task's audit): the playback-loop | 834 | // Loop (homeless per this task's audit): the playback-loop |
| 696 | // toggle -- burst-use during editing per the charter's own | 835 | // toggle -- burst-use during editing per the charter's own |
| 697 | // classification -- earns the transport cluster it plays | 836 | // classification -- earns the transport cluster it plays |
| 698 | // alongside, not the CUT group's `LoopTrim` two files over | 837 | // alongside, not the CUT group's `LoopTrim` two files over |
| 699 | // (a different verb already drawn on the spine, "↻" taken). | 838 | // (a different verb already drawn on the spine, "↻" taken). |
| 700 | // "∞" reads as "keeps going" without borrowing that glyph. | 839 | // "∞" reads as "keeps going" without borrowing that glyph. |
| 701 | - .child(ghost( | 840 | + .when(layers.sync, |el| { |
| 702 | - "stance-tb-loop", | 841 | + el.child(ghost( |
| 703 | - player, | 842 | + "stance-tb-loop", |
| 704 | - "∞", | 843 | + player, |
| 705 | - ActionId::Loop, | 844 | + "∞", |
| 706 | - player.loop_on, | 845 | + ActionId::Loop, |
| 707 | - cx, | 846 | + player.loop_on, |
| 708 | - )), | 847 | + cx, |
| 848 | + )) | ||
| 849 | + }), | ||
| 709 | ) | 850 | ) |
| 710 | // The audio-monitoring cluster (homeless per this task's audit): | 851 | // The audio-monitoring cluster (homeless per this task's audit): |
| 711 | // ToggleMute/VolumeUp/VolumeDown, burst-use per the charter, placed | 852 | // ToggleMute/VolumeUp/VolumeDown, burst-use per the charter, placed |
| @@ -717,7 +858,7 @@ pub(crate) fn render( | |||
| 717 | // mute and the two ghosts flanking it nudge the level -- three | 858 | // mute and the two ghosts flanking it nudge the level -- three |
| 718 | // homeless actions sharing one cluster rather than three unrelated | 859 | // homeless actions sharing one cluster rather than three unrelated |
| 719 | // rows. | 860 | // rows. |
| 720 | - .child( | 861 | + .when(layers.volume, |el| el.child( |
| 721 | div() | 862 | div() |
| 722 | .flex_none() | 863 | .flex_none() |
| 723 | .flex() | 864 | .flex() |
| @@ -731,19 +872,22 @@ pub(crate) fn render( | |||
| 731 | false, | 872 | false, |
| 732 | cx, | 873 | cx, |
| 733 | )) | 874 | )) |
| 875 | + // The level is NOT this button's label any more: the slider | ||
| 876 | + // beside it already draws the same number as a fill and | ||
| 877 | + // `volume_readout` writes it once, so wearing it here made | ||
| 878 | + // mute a ghost with no glyph of its own (a percentage is not | ||
| 879 | + // a verb). Speaker, struck when muted -- typographic, the | ||
| 880 | + // same hand-drawn grammar as the glyphs around it. | ||
| 734 | .child(ghost( | 881 | .child(ghost( |
| 735 | "stance-tb-mute", | 882 | "stance-tb-mute", |
| 736 | player, | 883 | player, |
| 737 | - if player.volume.muted { | 884 | + if player.volume.muted { "◁×" } else { "◁))" }, |
| 738 | - format!("× {}%", player.volume.percent()) | ||
| 739 | - } else { | ||
| 740 | - format!("{}%", player.volume.percent()) | ||
| 741 | - }, | ||
| 742 | ActionId::ToggleMute, | 885 | ActionId::ToggleMute, |
| 743 | player.volume.muted, | 886 | player.volume.muted, |
| 744 | cx, | 887 | cx, |
| 745 | )) | 888 | )) |
| 746 | .child(volume_slider(player, cx)) | 889 | .child(volume_slider(player, cx)) |
| 890 | + .child(volume_readout(player)) | ||
| 747 | .child(ghost( | 891 | .child(ghost( |
| 748 | "stance-tb-vol-up", | 892 | "stance-tb-vol-up", |
| 749 | player, | 893 | player, |
| @@ -752,9 +896,9 @@ pub(crate) fn render( | |||
| 752 | false, | 896 | false, |
| 753 | cx, | 897 | cx, |
| 754 | )), | 898 | )), |
| 755 | - ) | 899 | + )) |
| 756 | - .child(range_marks(player, cx)) | 900 | + .when(layers.marks, |el| el.child(range_marks(player, cx))) |
| 757 | - .child(cut_readout(player)) | 901 | + .child(cut_readout(player, position)) |
| 758 | .child(contact_strip(player, position, cx)) | 902 | .child(contact_strip(player, position, cx)) |
| 759 | .child(save_verb(player, cx)) | 903 | .child(save_verb(player, cx)) |
| 760 | .child(export_chip(player, cx)) | 904 | .child(export_chip(player, cx)) |