Merge look-fix3-dialogs app work

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Dylan M. Taylor
2026-11-30 00:01:35 +00:00
co-authored by Claude Opus 5.5
5 changed files with 34 additions and 7 deletions
+6 -2
View File
@@ -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);
}
+3 -1
View File
@@ -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()),
+3 -1
View File
@@ -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"))
+18
View File
@@ -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) {
+4 -3
View File
@@ -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<f64> {
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;