From 2c8e3aa151eb0ab655f319f6cdc69a4f66f2b3ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 12 Aug 2026 21:04:01 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(ui):=20the=20floor,=20the=20no?= =?UTF-8?q?tices=20and=20the=20silent=20refusals?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The transient bars hang off the bottom of the picture instead of taking a row of the column -- a notice arriving used to push the transport, the toolbar and the timeline down by its own height, which is every control below it moving with state. At 640x360 the timeline takes at most its share of the window and its lanes scroll inside it, the library tabs wrap rather than hanging off the panel, and the level's bar stands down while its button and its keys stay. A class refusal (esc with nothing exporting) is silent; a state refusal speaks. --- crates/app/src/main.rs | 73 +++++++++++++++++++++++++++-------- crates/app/src/ui/library.rs | 16 +++++++- crates/app/src/ui/overlays.rs | 3 ++ crates/app/src/ui/timeline.rs | 13 ++++++- crates/app/src/ui/toolbar.rs | 29 ++++++++++---- 5 files changed, 106 insertions(+), 28 deletions(-) diff --git a/crates/app/src/main.rs b/crates/app/src/main.rs index 3e59d13..364d80b 100644 --- a/crates/app/src/main.rs +++ b/crates/app/src/main.rs @@ -1620,10 +1620,19 @@ impl Player { // same controls sat dim and *dead* to the pointer. Whatever refuses the // button refuses the key, in the oracle's own words -- and a refusal // that is silent from the keyboard is a bug the same size. - if let Some(why) = self.enable(action, None).why() { - self.notice = Some(format!("{} — {why}", action.label()).into()); - cx.notify(); - return; + match self.enable(action, None) { + Enable::Yes => {} + // A state refusal is spoken: the thing exists and cannot happen + // *now*, which is exactly what a silent key press fails to say. + Enable::No(why) => { + self.notice = Some(format!("{} — {why}", action.label()).into()); + cx.notify(); + return; + } + // A class refusal is not: the action does not exist for what is in + // front of the user, and `esc` with nothing exporting must not + // answer with a line about exports. + Enable::Hidden(_) => return, } match action { ActionId::Play => self.toggle_or_restart(cx), @@ -5844,25 +5853,47 @@ impl Render for Player { ) // After the picture, so the plate is drawn // over it rather than under. - .children(self.subtitle_overlay(position, window)), + .children(self.subtitle_overlay(position, window)) + // The three transient lines hang off the + // bottom of the picture rather than taking + // a row of the column: a notice that + // arrives must not push the transport, the + // toolbar and the timeline down by its own + // height -- which is a control moving with + // state, on every control below it at once. + .child( + div() + .absolute() + .bottom_0() + .left_0() + .right_0() + .flex() + .flex_col() + .gap(px(2.)) + .children(self.import_bar(cx)) + .children(self.seek_bar()) + .children(self.notice_bar(cx)), + ), ) - .child(self.transport_bar(position, state, cx)), + .child(self.transport_bar( + position, + state, + f32::from(window.viewport_size().width), + cx, + )), ) // The settings cards live in here rather than over the // timeline: adjusting a clip must not hide the clip. .child(self.inspector(window.viewport_size(), cx)), ) - // Above the toolbar and only when there is one to show, so it costs - // the picture nothing the rest of the time. The import's line sits - // over the notice's: a notice is about something that has already - // happened, and this is about something still happening. - .children(self.import_bar(cx)) - // The same slot and the same reason: work still going on, said out - // loud because a still picture is the only other evidence of it. - .children(self.seek_bar()) - .children(self.notice_bar(cx)) .child(self.toolbar(cx)) - .child(self.timeline(position, duration, state, cx)) + .child(self.timeline( + position, + duration, + state, + f32::from(window.viewport_size().height), + cx, + )) // Over the region they were opened on, and under the modal cards: // they are only ever up while none of those is (`modal`). .children(self.context_card(window.viewport_size(), cx)) @@ -6902,7 +6933,10 @@ fn enable(action: ActionId, ctx: Ctx) -> Enable { ActionId::ToggleSubtitles | ActionId::RemoveSubtitleTrack if !ctx.subtitles => { Enable::No("no subtitles yet") } - ActionId::CancelExport => Enable::No("nothing is exporting"), + // Not `No`: with nothing running there is no export for this to be + // about at all, which is what keeps `esc` -- the same key -- a quiet + // way out of a card rather than a line about exports. + ActionId::CancelExport => Enable::Hidden("nothing is exporting"), // A clock started against an empty timeline is a clock counting // nothing: the transport says so by being dim, which is what its own // ad-hoc boolean used to say before the oracle knew the question. @@ -8293,6 +8327,11 @@ fn timeline_h(lanes: usize) -> f32 { /// cannot push a lane off the bottom. const TIMELINE_FIXED_H: f32 = 16. + 18. + 8. + RULER_HIT_H + 8. + 4.; +/// The most of a short window the timeline may take. At the 640x360 floor that +/// is 151 px of the 360, which leaves the picture a region rather than a +/// letterbox stripe -- and the lanes scroll inside it. +const TIMELINE_SHARE: f32 = 0.42; + /// The edit toolbar directly above the timeline: one control's height in its /// own padding, fixed so nothing in it can push the timeline down. const TOOLBAR_H: f32 = CONTROL_H + 16.; diff --git a/crates/app/src/ui/library.rs b/crates/app/src/ui/library.rs index 5d34529..54602a9 100644 --- a/crates/app/src/ui/library.rs +++ b/crates/app/src/ui/library.rs @@ -231,6 +231,11 @@ impl Player { .flex_1() .min_w(px(0.)) .flex() + // Wraps rather than clipping: at the 640 px floor + // this column is 128 px wide and the third tab + // would hang off its edge, which is a control the + // pointer cannot reach. + .flex_wrap() .gap(px(2.)) .children(LIBRARY_TABS.map(|tab| { let on = tab == self.library_tab; @@ -264,9 +269,16 @@ impl Player { .child(tab.label()) })), ) - .child(control( + , + ) + .child( + div().flex_none().child(control( "import", - 0., + // Full width of the column: the way media gets in is + // the one affordance in this panel that is always + // there, whatever tab is open and however narrow the + // window is. + width - 16., BG_RAISED, None, "Import", diff --git a/crates/app/src/ui/overlays.rs b/crates/app/src/ui/overlays.rs index 8ae9597..bfc53af 100644 --- a/crates/app/src/ui/overlays.rs +++ b/crates/app/src/ui/overlays.rs @@ -53,6 +53,9 @@ impl Player { // Hugs its label: the bar's own line is what wants // the width, and this button never relabels. 0., + // The ordinary plane -- the accent is Export's, and + // a way out of a read is not the primary action. + BG_RAISED, None, "Cancel", "stops this file and anything queued behind it; the read already \ diff --git a/crates/app/src/ui/timeline.rs b/crates/app/src/ui/timeline.rs index e8411ec..c8dc055 100644 --- a/crates/app/src/ui/timeline.rs +++ b/crates/app/src/ui/timeline.rs @@ -14,6 +14,7 @@ impl Player { position: f64, duration: f64, state: Transport, + viewport_h: f32, cx: &mut Context, ) -> impl IntoElement { // Where the playhead is *on the bed*, in pixels from its left edge. @@ -100,7 +101,10 @@ impl Player { }; div() .flex_none() - .h(px(timeline_h(lanes.len()) + strip_h)) + // Never more than its share of a short window: the lane column + // scrolls inside whatever it gets, and a timeline that pushes the + // picture off the screen at the 640x360 floor is not a timeline. + .h(px((timeline_h(lanes.len()) + strip_h).min(viewport_h * TIMELINE_SHARE))) .flex() .flex_col() .gap(px(8.)) @@ -227,7 +231,12 @@ impl Player { .child( div() .id("lanes") - .flex_none() + // Takes whatever the region has left and scrolls inside it: + // at the 640x360 floor the region is capped + // ([`TIMELINE_SHARE`]) and a fixed column would be clipped + // by it rather than scrolled. + .flex_1() + .min_h(px(0.)) .flex() .flex_col() .gap(px(8.)) diff --git a/crates/app/src/ui/toolbar.rs b/crates/app/src/ui/toolbar.rs index 05535f8..4840c6a 100644 --- a/crates/app/src/ui/toolbar.rs +++ b/crates/app/src/ui/toolbar.rs @@ -131,9 +131,18 @@ impl Player { &self, position: f64, state: Transport, + viewport_w: f32, cx: &mut Context, ) -> impl IntoElement { let muted = self.volume.muted; + // The room this strip actually has: the window less the two side + // panels. At the 640 px floor that is ~300 px, which the clock and the + // level together do not fit -- so the level's *bar* stands down (its + // button, its keys and its row on the actions card all remain), and + // the clock keeps a narrower rect rather than being pushed off. + let room = viewport_w - library_w(viewport_w) - inspector_w(viewport_w); + let clock_w = TIME_W.min(room - 140.).max(96.); + let slider = room >= TRANSPORT_ROOMY; div() .flex_none() .h(px(TRANSPORT_H)) @@ -160,7 +169,7 @@ impl Player { .child( div() .flex_none() - .w(px(TIME_W)) + .w(px(clock_w)) .truncate() .text_color(rgb(FG_PRIMARY)) .child(format!( @@ -201,12 +210,14 @@ impl Player { true => STATUS_WARNING, false => FG_PRIMARY, })) - .child(volume_slider( - self.volume, - self.volume_bar.clone(), - self.enable(ActionId::ToggleMute, None).yes(), - cx, - )) + .when(slider, |d| { + d.child(volume_slider( + self.volume, + self.volume_bar.clone(), + self.enable(ActionId::ToggleMute, None).yes(), + cx, + )) + }) } /// The edit toolbar, directly above the timeline it acts on: split, delete, @@ -420,3 +431,7 @@ pub(crate) const ZOOM_SLOT_W: f32 = 76.; pub(crate) const VOLUME_SLOT_W: f32 = 76.; /// The HDR rendition's names are the longest words on any button here. pub(crate) const TONE_SLOT_W: f32 = 148.; + +/// The width the transport strip needs before the level's bar fits beside the +/// clock: play + clock + the mute button + the bar, in their gaps. +pub(crate) const TRANSPORT_ROOMY: f32 = 460.;