diff --git a/DESIGN.md b/DESIGN.md index 5d32323..9ba2d00 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -340,7 +340,10 @@ Before any new surface merges, it answers: 4. **Scale:** define its degradation ladder step-by-width before merge. 5. **Achromatic check:** zero new hues in chrome; film inks only for identity; white only if it is literally the lamp. -6. **Occlusion check:** the picture stays visible; nothing floats over the screen. +6. **Occlusion check:** the picture stays visible; nothing floats over the screen. Accepted + exceptions are named where they live: the held-`?` cheat-sheet (amendment above), and the + settings page, a centred modal since 2026-09-19 (user: the below-picture sheet covered the + timeline) — it floats over the screen while open, and closes on a click away or `esc`. 7. **States:** empty (safelight-composed, never bare), refusing (reason named), failing (notice plate with remedy). 8. **Feel:** one ≤150ms motion spec from §10's vocabulary, or a stated reason for none. diff --git a/crates/app/src/export_ui.rs b/crates/app/src/export_ui.rs index b037794..cf0f134 100644 --- a/crates/app/src/export_ui.rs +++ b/crates/app/src/export_ui.rs @@ -686,13 +686,15 @@ pub(crate) fn probe_settings(format: Format, audio_kbps: u32, seat: EncoderSeat) /// The budget's bounds, the engine's own (`engine::export`'s `MIN_BITRATE` /// and `MAX_EXPLICIT_BITRATE`): a number outside them would be written as a -/// different one, so the lever and the field clamp to exactly these. -pub(crate) const BPS_MIN: u64 = 1_000_000; +/// different one, so the lever and the field clamp to exactly these. The floor +/// is 100 kbps, not a megabit: a sub-Mbps delivery is an export too, and at a +/// megabit this row could not say `0.6` at all. +pub(crate) const BPS_MIN: u64 = 100_000; pub(crate) const BPS_MAX: u64 = 50_000_000; -/// A wheel notch, and a notch with shift held: 0.1 and 1 Mbps. Fifty presses -/// is not a way across this range, and a tenth is the smallest step the row's -/// own readout can show. +/// A wheel notch, and a notch with shift held: 0.1 and 1 Mbps. Five hundred +/// tenths is not a way across this range, and a tenth is the smallest step +/// the row's own readout can show. pub(crate) const BPS_FINE: u64 = 100_000; pub(crate) const BPS_COARSE: u64 = 1_000_000; diff --git a/crates/app/src/player/export.rs b/crates/app/src/player/export.rs index 556165f..389661d 100644 --- a/crates/app/src/player/export.rs +++ b/crates/app/src/player/export.rs @@ -536,7 +536,7 @@ impl Player { if self.custom_bps > 0 { return self.custom_bps; } - self.session.as_ref().map_or(BPS_MIN * 6, |s| { + self.session.as_ref().map_or(6_000_000, |s| { let (w, h) = s.resolution(); auto_bps(w, h, s.meta().frame_rate) }) diff --git a/crates/app/src/tests/cards.rs b/crates/app/src/tests/cards.rs index b426fd6..e7da37e 100644 --- a/crates/app/src/tests/cards.rs +++ b/crates/app/src/tests/cards.rs @@ -907,13 +907,13 @@ fn the_budget_is_the_one_number_the_engine_gets() { } // The lever's bounds are the engine's own (`MIN_BITRATE`, // `MAX_EXPLICIT_BITRATE`), so no reachable number is silently rewritten. - assert_eq!(BPS_MIN, 1_000_000); + assert_eq!(BPS_MIN, 100_000); assert_eq!(BPS_MAX, 50_000_000); // The default the lever opens on is the engine's automatic figure for // the picture that is open -- never the 0 Mbps the old `custom_mbps: 0` // put on screen. assert_eq!(auto_bps(1920, 1080, 30.), 6_220_800); - assert!(auto_bps(320, 240, 30.) >= BPS_MIN, "a tiny picture floors"); + assert_eq!(auto_bps(160, 120, 15.), BPS_MIN, "a tiny picture floors"); assert!(auto_bps(7680, 4320, 60.) <= 20_000_000, "and a huge one caps"); for bps in [auto_bps(1920, 1080, 30.), auto_bps(320, 240, 24.)] { assert!((BPS_MIN..=BPS_MAX).contains(&bps)); @@ -930,9 +930,11 @@ fn a_budget_is_said_four_ways_and_lands_inside_the_engines_range() { assert_eq!(parse_budget("6.5", seconds, audio), Some(6_500_000)); assert_eq!(parse_budget("6.5 mbps", seconds, audio), Some(6_500_000)); assert_eq!(parse_budget("12M", seconds, audio), Some(12_000_000)); - // 850 kbps is under the engine's floor, so it lands *on* the floor -- - // clamped, and shown clamped in the same keystroke. - assert_eq!(parse_budget("850k", seconds, audio), Some(BPS_MIN)); + // A sub-Mbps ask is a rate this row can say: 850 kbps travels as itself. + assert_eq!(parse_budget("850k", seconds, audio), Some(850_000)); + // Under the engine's floor it lands *on* the floor -- clamped, and shown + // clamped in the same keystroke. + assert_eq!(parse_budget("50k", seconds, audio), Some(BPS_MIN)); assert_eq!(parse_budget("2500k", seconds, audio), Some(2_500_000)); // `G` is a target file size: 1.2 GB over a minute is 160 Mbit/s of file, // less the sound -- past the ceiling, so the ceiling is what is written. @@ -964,8 +966,9 @@ fn the_budget_lever_steps_by_a_tenth_and_a_whole_megabit() { assert_eq!(BPS_COARSE, 1_000_000); assert_eq!(rate_label(6_000_000 + BPS_FINE), "6.1"); assert_eq!(rate_label(6_000_000 + BPS_COARSE), "7.0"); - // Fifty notches of the coarse step crosses the whole range, which is - // what a wheel is for; the fine one would take five hundred. + // Forty-nine coarse notches carry the range with change left in the + // fiftieth, which is what a wheel is for; the fine step would take five + // hundred. assert_eq!((BPS_MAX - BPS_MIN) / BPS_COARSE, 49); // The step arithmetic itself, as `Player::nudge_budget` does it: a // saturating walk that stops at both ends rather than wrapping. diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index 46e367f..1295713 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -4093,6 +4093,63 @@ fn the_settings_sections_are_tabs_that_carry_their_own_explanation() { } } +/// The page's own geometry, after the user retired the below-picture sheet +/// (2026-09-19: "this settings section should be a modal instead of covering +/// the timeline"). The page is a centred modal now -- a centred scrim and a +/// plate of one tabbed column's own measure, never `w_full()`, which put a +/// `justify_between` row's value a window away from its label, and never the +/// [`crate::ui::stance::below_picture_floor`] anchor that laid the sheet over +/// the bench at the window's full width. The height is a viewport cap with +/// headroom, the rows scroll under the strip when a short window cannot hold +/// them, and the modal keeps the two things its callers read: the +/// `settings-card` id and the press-away exit (`this.close_card()`, the same +/// one every other card's scrim leads with). A source scan, like every other +/// guard on this page -- this binary renders no window of its own. +#[test] +fn the_settings_page_is_a_centred_modal_with_one_column_of_measure() { + let source = src_text("ui/settings_stance.rs"); + let start = source + .find("pub(crate) fn render(") + .expect("the page's render fn"); + let body = &source[start..]; + let end = body.find("\n}\n").map_or(body.len(), |at| at + 2); + let body = &body[..end]; + + // Centred on both axes, and the below-picture sheet gone with the rest + // of it: no floor arithmetic, no bottom-edge alignment, no full-width + // plate. + for needle in [".justify_center()", ".items_center()"] { + assert!(body.contains(needle), "the settings modal lost {needle}"); + } + for gone in ["below_picture_floor", "items_end()", "w_full()"] { + assert!( + !body.contains(gone), + "the settings page drew {gone} again -- that is the below-picture sheet, \ + not the centred modal the user asked for" + ); + } + // The plate: one column's own measure with its yield for a narrow centre + // column, a capped height, and the rows scrolled inside the cap. + for needle in [ + ".id(\"settings-card\")", + ".w(px(SETTINGS_W))", + ".max_w(relative(1.))", + ".max_h(px(max_h))", + "\"settings-rows\"", + "overflow_y_scroll()", + ] { + assert!( + body.contains(needle), + "the settings modal lost {needle} -- the plate is no longer one capped \ + column with its rows scrolling" + ); + } + assert!( + body.contains("this.close_card()"), + "the settings scrim swallows the press without closing the modal" + ); +} + /// The Picture row said every refused format's reason after its value /// (`H.264 no picture -- an mp4 would \u{b7} AV1 no picture -- ...`; the user /// called it "funny"). A row says its own pick: one value, and a refusal only diff --git a/crates/app/src/tests/media.rs b/crates/app/src/tests/media.rs index 087b78e..eee46f2 100644 --- a/crates/app/src/tests/media.rs +++ b/crates/app/src/tests/media.rs @@ -796,10 +796,12 @@ fn the_budget_row_states_the_size_before_it_is_written() { assert_eq!(size_label(999_999_999), "1000 MB"); assert_eq!(size_label(1_000_000_000), "1.00 GB"); assert_eq!(size_label(1_240_000_000), "1.24 GB"); - // The lever's own readout, one decimal, in the unit it is moved in. + // The lever's own readout, one decimal, in the unit it is moved in -- + // including below a megabit, which is where the floor lives now. assert_eq!(rate_label(6_000_000), "6.0"); assert_eq!(rate_label(6_500_000), "6.5"); - assert_eq!(rate_label(BPS_MIN), "1.0"); + assert_eq!(rate_label(600_000), "0.6"); + assert_eq!(rate_label(BPS_MIN), "0.1"); // Row 3's range readout: the marked span where there is one, and a // sound-only file names no film to take a range from. assert_eq!(range_word(None, true), "whole film"); diff --git a/crates/app/src/ui/settings_stance.rs b/crates/app/src/ui/settings_stance.rs index 620986e..8d471b4 100644 --- a/crates/app/src/ui/settings_stance.rs +++ b/crates/app/src/ui/settings_stance.rs @@ -777,38 +777,51 @@ fn export_section(player: &Player, cx: &mut Context) -> impl IntoElement )) } -/// The page itself: a plate in the room's own below-picture footprint, -/// closed by a click away or `esc` through [`Player::close_card`] like every -/// other card here. +/// The centred modal's plate width: one tabbed column's own measure, wide +/// enough for the longest row a section carries (the EXPORT range's marks +/// line, its chords and all) beside its label -- and no wider. The sheet this +/// replaces was `w_full()`, which read every row as a line stretched across +/// the room with its value a window away from the label it belongs to. +/// [`KEYS_W`]'s class, and a step past its number: these rows carry the same +/// label-left/stroke-right anatomy with a value where that card has none. +const SETTINGS_W: f32 = 480.; + +/// The breathing room the modal keeps against the window edge, and the +/// margin the plate's height cap is measured less -- headroom that keeps a +/// short window's plate off both edges rather than clipped against them. +const SETTINGS_EDGE: f32 = 24.; + +/// The floor under that cap, so a very short window's plate still shows the +/// strip and a row under it -- the rows scroll from there. +const SETTINGS_MIN_H: f32 = 160.; + +/// The page itself: a centred modal card, closed by a click away or `esc` +/// through [`Player::close_card`] like every other card here. /// -/// It used to be a centred modal over a dimming scrim, which put the whole -/// settings sheet -- and every picker opened off one of its rows -- straight -/// over the picture: DESIGN §11 check 6's one hard occlusion rule, and half -/// of the user's 2026-08-21 report about menus "not aligning with our -/// design". Anchored to [`crate::ui::stance::below_picture_floor`] it sits -/// over the bench and ledger exactly as the export plate and the menus -/// already do, and the catcher behind it paints nothing rather than tinting -/// the frame. +/// It held to [`crate::ui::stance::below_picture_floor`] from 2026-08-21 +/// until 2026-09-19: a centred sheet then drew the whole page -- and every +/// picker opened off one of its rows -- over the picture (DESIGN §11 check +/// 6's occlusion rule, half of the user's own report about menus "not +/// aligning with our design"), so the page was anchored over the bench and +/// ledger at the window's full width. The user 2026-09-19 retired that read +/// -- "this settings section should be a modal instead of covering the +/// timeline" -- so the plate is centred again, at one tabbed column's own +/// measure: it floats over the room's middle, the timeline beneath is not +/// laid under a full-width sheet, and a short window scrolls the rows under +/// the strip rather than clipping them. The catcher still paints nothing +/// rather than tinting the frame, the same rule the menus it opens follow. pub(crate) fn render( player: &Player, window_size: Size, cx: &mut Context, ) -> impl IntoElement { - let floor = crate::ui::stance::below_picture_floor( - f32::from(window_size.height), - player.split_px(Split::Bench, window_size), - ); - // Below the time band, not merely below the picture: the transport and - // the Export chip live on that band and a sheet over them hides controls - // the editor is still using. Bench + ledger is this page's footprint. - let top = floor + crate::ui::stance::TIME_BAND_H; - let room = f32::from(window_size.height) - top; + // The plate's own cap, a [`SETTINGS_EDGE`] off each edge. + let max_h = (f32::from(window_size.height) - 2. * SETTINGS_EDGE).max(SETTINGS_MIN_H); drag_scrim(cx) .flex() .justify_center() - .items_end() - .pt(px(top + 6.)) - .pb(px(6.)) + .items_center() + .p(px(SETTINGS_EDGE)) .on_mouse_down( MouseButton::Left, cx.listener(|this, _: &MouseDownEvent, _, cx| { @@ -820,14 +833,15 @@ pub(crate) fn render( .child( div() .id("settings-card") - // The whole footprint's width: at 720p a 420px single column - // put Mix, the palette and the subtitle font below a fold with - // no visible scrollbar -- settings an editor cannot see are - // settings only a chord reaches, which is the defect class - // this page exists to close. The strip spends the width on - // tabs, and one section shows flat beneath it. - .w_full() - .max_h(px((room - 12.).max(120.))) + // One tabbed column's own measure, never the window's: the + // sheet this replaces spent the full width on one section -- + // a folded list is now answered by the height cap and + // `settings-rows`' own scroll, not by the plate reaching for + // the window's edges. `max_w` yields to a centre column + // narrower than the measure (the 640px floor's own case). + .w(px(SETTINGS_W)) + .max_w(relative(1.)) + .max_h(px(max_h)) .on_mouse_down(MouseButton::Left, swallow) .flex() .flex_col() diff --git a/crates/engine/src/export.rs b/crates/engine/src/export.rs index 4b96766..5c0c0aa 100644 --- a/crates/engine/src/export.rs +++ b/crates/engine/src/export.rs @@ -112,7 +112,12 @@ fn picture_progress(done: u32, total: u32) -> u32 { /// D2 rate control: bits per pixel per second, then a sane range. 720p30 lands /// at 2.76 Mbps, which S1 measured the software encoder hitting within 1%. const BITS_PER_PIXEL: f64 = 0.1; -const MIN_BITRATE: u64 = 1_000_000; +/// The floor under a rate somebody *asked* for, and under the derived one: 100 +/// kbps, so a sub-Mbps budget -- a lo-fi delivery, a tiny picture, a +/// phone-rate master -- is a rate this export is written at. A megabit was the +/// old floor, and it silently rewrote every such ask. Nothing below this is +/// worth a container: the sound's own row starts at 128 kbps. +const MIN_BITRATE: u64 = 100_000; const MAX_BITRATE: u64 = 20_000_000; /// The ceiling on a bitrate somebody *asked* for, which is a different question @@ -679,8 +684,9 @@ fn faded(project: &Project) -> bool { } /// The bitrate an export codes at: the caller's number clamped into what an -/// asked-for rate may be ([`MAX_EXPLICIT_BITRATE`]), the derived one where there -/// was none. Clamped rather than refused, for the reason [`Enc::open`] states. +/// asked-for rate may be ([`MIN_BITRATE`]..[`MAX_EXPLICIT_BITRATE`]), the +/// derived one where there was none. Clamped rather than refused, for the +/// reason [`Enc::open`] states. fn bitrate_of(meta: &VideoMeta, settings: &ExportSettings) -> u64 { settings.bitrate.map_or_else( || bitrate_for(meta), @@ -5370,7 +5376,8 @@ mod tests { }; // 1280 * 720 * 30 * 0.1 assert_eq!(bitrate_for(&meta(1280, 720, 30.0)), 2_764_800); - assert_eq!(bitrate_for(&meta(320, 240, 30.0)), MIN_BITRATE, "tiny"); + assert_eq!(bitrate_for(&meta(320, 240, 30.0)), 230_400, "tiny"); + assert_eq!(bitrate_for(&meta(160, 120, 15.0)), MIN_BITRATE, "tinier floors"); assert_eq!(bitrate_for(&meta(3840, 2160, 60.0)), MAX_BITRATE, "huge"); // A rate somebody typed goes through untouched to its own ceiling, which // is above where the derived one stops: the card offers 50 Mbps, and a @@ -5386,6 +5393,7 @@ mod tests { }; assert_eq!(asked(50_000_000), 50_000_000, "the card's ceiling travels"); assert_eq!(asked(21_000_000), 21_000_000, "past the derived range"); + assert_eq!(asked(600_000), 600_000, "a sub-Mbps ask travels"); assert_eq!(asked(999_000_000), MAX_EXPLICIT_BITRATE, "still bounded"); assert_eq!(asked(1), MIN_BITRATE, "and floored"); }