From c928365a61c6f5596cf39010b5e696545b1e8f97 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 29 Nov 2026 23:52:32 +0000 Subject: [PATCH] Dialogs and show: Bullets selection fill, As: and Available formats: headings, zoom stays over the fitted slide Bullets and Numbering shows the chosen style under the selection fill (PictureEdge::Fill) instead of an accent ring. Paste Special's As: and Date and Time's Available formats: keep production's colon (Word labels). The show canvas bounds a zoom by the fitted picture (ScrollBounds::Fitted), so a zoom at the slide's top keeps it over the letterboxed picture as production does; test a_zoom_at_the_slides_top_stays_over_the_fitted_picture. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/dialogs/bullets.rs | 8 ++++++-- crates/ui-egui/src/dialogs/choice_forms.rs | 4 +++- crates/ui-egui/src/dialogs/date_time.rs | 4 +++- crates/ui-egui/src/show/tests.rs | 18 ++++++++++++++++++ crates/ui-egui/src/show/ui.rs | 7 ++++--- 5 files changed, 34 insertions(+), 7 deletions(-) diff --git a/crates/ui-egui/src/dialogs/bullets.rs b/crates/ui-egui/src/dialogs/bullets.rs index 96606ce71..0bcc455eb 100644 --- a/crates/ui-egui/src/dialogs/bullets.rs +++ b/crates/ui-egui/src/dialogs/bullets.rs @@ -6,7 +6,7 @@ use craft::ui::patterns::form_dialogs::{ use craft::ui::pickers::{IconPicker, IconPickerGroup, IconPickerItem, IconPickerSearch}; use craft::ui::runtime::env::UnitKind; use craft::ui::sections::{DialogRole, FooterButton}; -use craft::ui::tile_grid::GlyphLayout; +use craft::ui::tile_grid::{GlyphLayout, PictureEdge}; use egui::Context; use serde_json::{Value, json}; @@ -40,7 +40,11 @@ fn styles( )]; Param::custom(key, label, move |ui, fields, _| { let selected = fields.text(key).map(str::to_owned); - let out = IconPicker::new(label, Bind::given(selected), &groups).search(IconPickerSearch::None).columns(columns).show(ui); + let out = IconPicker::new(label, Bind::given(selected), &groups) + .search(IconPickerSearch::None) + .columns(columns) + .picture_edge(PictureEdge::Fill) + .show(ui); if let Some(picked) = out.picked { fields.set(key, picked); } diff --git a/crates/ui-egui/src/dialogs/choice_forms.rs b/crates/ui-egui/src/dialogs/choice_forms.rs index d68bffbc0..374258b53 100644 --- a/crates/ui-egui/src/dialogs/choice_forms.rs +++ b/crates/ui-egui/src/dialogs/choice_forms.rs @@ -70,12 +70,14 @@ pub(crate) mod paste_special { Bind, Context, DialogFields, DialogHost, HostedParamDialog, Param, ParamDialog, ParamKind, ParamLayout, ParamResult, RadioLayout, SlideApp, Value, json, }; + use craft::ui::runtime::env::Word; /// Opens paste choices with reasons for formats requiring copied shapes. pub(crate) fn open(app: &SlideApp, ctx: &Context, _: &Value) -> HostedParamDialog { + // A Word keeps its colon: the heading over the options reads "As:", as production's does. let mut paste = Param::new( "as", - "As:", + Word::plain("As:"), ParamKind::radio( vec![ ("destinationTheme".into(), "Use Destination Theme".into()), diff --git a/crates/ui-egui/src/dialogs/date_time.rs b/crates/ui-egui/src/dialogs/date_time.rs index 4ea9dcc2b..d45789e8a 100644 --- a/crates/ui-egui/src/dialogs/date_time.rs +++ b/crates/ui-egui/src/dialogs/date_time.rs @@ -3,6 +3,7 @@ use craft::ui::contract::{Bind, SelectMode, ShowCollection as _}; use craft::ui::dialog::DialogHost; use craft::ui::list::{List, ListRow}; use craft::ui::patterns::form_dialogs::{DialogFields, HostedParamDialog, Param, ParamDialog, ParamKind, ParamLayout, ParamResult}; +use craft::ui::runtime::env::Word; use deckcraft_text::datetime::DATE_KINDS; use egui::Context; use serde_json::{Value, json}; @@ -39,7 +40,8 @@ pub(super) fn date_rows(lang: &str) -> Vec<(&'static str, String)> { pub(crate) fn open(_app: &SlideApp, ctx: &Context, _params: &Value) -> HostedParamDialog { HostedParamDialog::new(ctx, "dateTime", DialogFields::new(), |fields| { let params = vec![ - Param::custom("format", "Available formats", |ui, fields, _| { + // A Word keeps its colon: the list's heading reads "Available formats:", as production's does. + Param::custom("format", Word::plain("Available formats:"), |ui, fields, _| { let language = fields.text("language").unwrap_or("en-US"); let rows = date_rows(language); if !rows.iter().any(|(kind, _)| Some(*kind) == fields.text("format")) diff --git a/crates/ui-egui/src/show/tests.rs b/crates/ui-egui/src/show/tests.rs index fccd554c2..46fdd0cde 100644 --- a/crates/ui-egui/src/show/tests.rs +++ b/crates/ui-egui/src/show/tests.rs @@ -805,6 +805,24 @@ fn ctrl_wheel_zooms_the_show_and_the_plain_wheel_turns_the_page() { } } +/// A zoom at the top of the letterboxed slide keeps the slide over the fitted picture, as production's zoom window +/// stays on the slide: its top edge stays at the picture's, not pushed up to the window's. +#[test] +fn a_zoom_at_the_slides_top_stays_over_the_fitted_picture() { + use craft::behavior::kurbo::Point; + let mut h = show_of_three(); + let fitted = h.state().show.as_ref().unwrap().view; + let top = fitted.to_screen(Point::ZERO).y; + assert!(top > fitted.rect.top() + 1.0, "premise: the slide is letterboxed: {top} in {:?}", fitted.rect); + show_wheel(&mut h, pos2(fitted.rect.center().x, top + 1.0), 4.0, egui::Modifiers::CTRL); + h.run_steps(2); + let show = h.state().show.as_ref().expect("still showing"); + assert!(show.zoomed, "the wheel zooms in"); + let zoomed = show.view.to_screen(Point::ZERO).y; + assert!(zoomed <= top + 0.5, "the zoomed slide still covers the picture's top: {zoomed} against {top}"); + assert!(zoomed > fitted.rect.top() + 1.0, "the slide is not pushed up to the window's top: {zoomed}"); +} + /// Number keys pressed in the audience window, or in the presenter window when `presenter`, type a slide number /// that Escape clears and Enter goes to. fn typed_digits_go_to_a_slide(presenter: bool) { diff --git a/crates/ui-egui/src/show/ui.rs b/crates/ui-egui/src/show/ui.rs index dc695cf53..78dfcd6bb 100644 --- a/crates/ui-egui/src/show/ui.rs +++ b/crates/ui-egui/src/show/ui.rs @@ -12,8 +12,8 @@ use craft::timeline::ui::transport::MediaControls; use craft::ui::bars::BarBackgroundPress; use craft::ui::buttons::IconButton; use craft::ui::canvas::{ - AppPaint, Canvas, NavigationOptions, PageBorder, PageFrame, Pasteboard, PasteboardColor, RasterDisplay, ToolHost, ViewCommands, ViewFit, - ViewTarget, WheelScheme, tool_pass, with_canvas_space, + AppPaint, Canvas, NavigationOptions, PageBorder, PageFrame, Pasteboard, PasteboardColor, RasterDisplay, ScrollBounds, ToolHost, ViewCommands, + ViewFit, ViewTarget, WheelScheme, tool_pass, with_canvas_space, }; use craft::ui::contract::{Bind, BodyCx, Pad, Props as _, Show as _, ShowContainer as _, ThemeScope, clicked}; use craft::ui::display::{Shade, Text}; @@ -132,7 +132,8 @@ fn grid_pass(app: &mut SlideApp, ui: &mut Ui, bcx: &mut BodyCx<'_>, show: &mut S fn canvas_pass(app: &mut SlideApp, ui: &mut Ui, bcx: &mut BodyCx<'_>, show: &mut Show, p: &PagePass<'_>, out: &mut Out) -> Option { let ctx = ui.ctx().clone(); - let target = ViewTarget::new(p.zoom.size).fit(ViewFit::EdgeToEdge); + // A zoomed slide stays over the fitted picture, as production's zoom window stays on the slide. + let target = ViewTarget::new(p.zoom.size).fit(ViewFit::EdgeToEdge).scroll(ScrollBounds::Fitted); let room = bars::slide_room(p.room, show.reading); let mut navigation = NavigationOptions::default(); navigation.wheel = WheelScheme::Document;