Natural-height collections in scrolling bodies, ribbon size boxes commit on Enter, Browse for Themes is a Themes-group button, Align menu named apart from its button; DIAG for text editor, album pick and show Escape

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Dylan M. Taylor
2026-11-27 18:04:20 +00:00
co-authored by Claude Opus 5.5
parent cdedef1429
commit d0fae03715
8 changed files with 20 additions and 12 deletions
+1 -1
View File
@@ -276,7 +276,7 @@ fn choose(
current: &'static str,
) -> &'static str {
let source = keyed(rows, |row| row.0).with_text(|row| std::borrow::Cow::Borrowed(row.1));
let output = List::new(label).select(SelectMode::Single).sizing(Sizing::Content).selection(Bind::given(Selection::single(current))).show_items(
let output = List::new(label).select(SelectMode::Single).sizing(Sizing::Content).natural_height(true).selection(Bind::given(Selection::single(current))).show_items(
ui,
&source,
&mut |key, _| {
+10 -2
View File
@@ -310,14 +310,19 @@ fn document_bounds(points: [deckcraft_geom::Point; 4], transform: Affine) -> Rec
/// Hosts the edited shape or cell while no dialog, palette, File view or other text field owns input.
pub(crate) fn show_editor(app: &mut crate::SlideApp, ui: &mut Ui, space: &CanvasSpace) -> Option<TextEditorOutput> {
if crate::dialogs::modal_open(ui.ctx()) || app.palette_open || app.backstage_open() {
eprintln!("DIAG korean_composes_in_a_slide_text_box: blocked modal={} palette={} backstage={}", crate::dialogs::modal_open(ui.ctx()), app.palette_open, app.backstage_open());
return None;
}
let state = app.session.active()?;
let target = state.selection.text.as_ref().filter(|target| !target.notes)?.clone();
let Some(target) = state.selection.text.as_ref().filter(|target| !target.notes).cloned() else {
eprintln!("DIAG korean_composes_in_a_slide_text_box: no text target");
return None;
};
let id = ui.make_persistent_id(("slide-text-editor", state.uid, target.shape, target.cell));
if focus::focused_rec(ui.ctx())
.is_some_and(|record| record.stop.id != id && record.stop.text && !record.stop.keys.is_document_editor())
{
eprintln!("DIAG korean_composes_in_a_slide_text_box: another text stop owns focus");
return None;
}
if let Err(error) = app.session.begin_text_edit_session() {
@@ -325,7 +330,10 @@ pub(crate) fn show_editor(app: &mut crate::SlideApp, ui: &mut Ui, space: &Canvas
return None;
}
let mut host = EngineTextHost::new(&mut app.session, target);
let bounds = host.bounds(space)?;
let Some(bounds) = host.bounds(space) else {
eprintln!("DIAG korean_composes_in_a_slide_text_box: no bounds, frame={}", host.frame.is_some());
return None;
};
let mut selection = host.offsets.selection(&host.target);
let editor = TextEditor::new("Text", &mut host, Bind::bound(&mut selection)).id(id).click_runs(ClickRuns::Paragraphs);
let output = if app.caret_blink == Some(false) {
@@ -310,6 +310,7 @@ fn append_picture(dialog: &mut HostedParamDialog, name: &str, bytes: &[u8], tota
pub(crate) fn each_pass(app: &mut SlideApp, _ctx: &egui::Context, dialog: &mut HostedParamDialog) {
let files = app.host.files();
for action in dialog.take_actions() {
eprintln!("DIAG create_inserts_the_album_in_one_step: action {action} pick={:?} can_pick={}", app.dialogs.album_pick, files.can_pick());
if action == "addPictures" && app.dialogs.album_pick.is_none() {
if files.can_pick() {
app.dialogs.album_pick = Some(files.pick(PickRequest::open_many("picture")));
+1
View File
@@ -19,6 +19,7 @@ pub(crate) fn preset_grid<K: Clone + Eq + std::hash::Hash + Send + Sync + 'stati
let source = keyed(&presets, |(key, _)| key.clone()).with_text(|(_, label)| label.as_str().into());
let out = TileGrid::new(label.to_owned())
.natural_height(true)
.caption(CaptionPlace::None)
.select(SelectMode::Single)
.thumb_size(ThumbSize::Small)
+3 -4
View File
@@ -148,7 +148,7 @@ pub(crate) fn arrange_group(app: &mut SlideApp, row: &mut RibbonRow<'_>) {
.trailing_icon(DisclosureGlyph::menu_button())
.popup(PopupKind::Menu)
.show(ui);
Menu::new("Align").opened_by(&align.response, Trigger::Click).show(ui, |ui, cx| align_menu(app, ui, cx));
Menu::new("Align options").opened_by(&align.response, Trigger::Click).show(ui, |ui, cx| align_menu(app, ui, cx));
Stack::new().show(ui, |ui, _| {
// PLAN: plan error: SplitButton lacks independent menu enablement; disabled arrange.group blocks enabled Ungroup for one selected group
for (id, label, icon, options) in [
@@ -185,9 +185,8 @@ pub(crate) fn size_group(app: &mut SlideApp, row: &mut RibbonRow<'_>) {
row.group(RibbonGroup::new("size", "Size", IconSpec::from(Icon::SlideSize.id())), |ui| {
Stack::new().show(ui, |ui, _| {
for (label, param, initial) in [("Height", "h", bx.map(|x| x.h)), ("Width", "w", bx.map(|x| x.w))] {
let mut value = initial;
let out = NumberField::length(label, Bind::bound(&mut value), lengths).enabled(bx.is_some()).show(ui);
if out.response.changed() && let Some(value) = value {
let out = NumberField::length(label, Bind::given(initial), lengths).enabled(bx.is_some()).show(ui);
if let Some(value) = out.events.committed().and_then(|value| *value) {
let _ = app.run("shape.resize", json!({(param): value.max(0.0)}));
}
}
+2 -4
View File
@@ -41,10 +41,6 @@ pub(crate) fn design(app: &mut SlideApp, row: &mut RibbonRow<'_>) {
more_pick = Some(names[i].clone());
cx.request_close();
}
// PLAN: plan error: design.browseTheme requires import data; the picker command is app.browseThemeDialog.
if Button::command("app.browseThemeDialog").label("Browse for Themes…").show(ui).clicked() {
cx.request_close();
}
};
let output = Gallery::new("Themes", &items, selected.as_ref())
.tiles(5, 2)
@@ -55,6 +51,8 @@ pub(crate) fn design(app: &mut SlideApp, row: &mut RibbonRow<'_>) {
if let Some(name) = output.picked.and_then(|i| names.get(i).cloned()).or(more_pick) {
let _ = app.run("design.theme", json!({"name": name}));
}
// PLAN: plan error: design.browseTheme requires import data; the picker command is app.browseThemeDialog.
Button::command("app.browseThemeDialog").label("Browse for Themes…").icon(Icon::Themes.id()).show(ui);
});
if let Some(th) = app.session.active().and_then(|d| d.doc.masters.first().map(|m| m.theme.clone())) {
let variants = deckcraft_model::theme::theme_variants(&th);
+1 -1
View File
@@ -85,7 +85,7 @@ pub(crate) fn picture_format(app: &mut SlideApp, row: &mut RibbonRow<'_>) {
MenuItem::heading("Recolor").show(ui);
let sc = app.color_scheme();
let presets = deckcraft_engine::cmd::recolor::presets();
if let Some(preset) = style_grid(ui, TileGrid::new("Recolor"), &presets, None, ThumbAspect::new(40, 30), |cx, rect, id| {
if let Some(preset) = style_grid(ui, TileGrid::new("Recolor").natural_height(true), &presets, None, ThumbAspect::new(40, 30), |cx, rect, id| {
paint_recolor(cx, rect, id, &sc)
}) {
let _ = app.run("picture.recolor", json!({"preset": preset}));
+1
View File
@@ -228,6 +228,7 @@ fn publish(bcx: &mut BodyCx<'_>, show: &Show) {
fn commands(bcx: &mut BodyCx<'_>, show: &mut Show, doc: &Arc<Presentation>, now: f64, zoom: &ShowZoomInputs<'_>, out: &mut Out) {
// take_command drains only this pass's firings; reruns never replay a held key or a previous click.
while let Some((command, _)) = bcx.take_command::<ShowCommands>() {
eprintln!("DIAG leaving_the_ppsx_show_keeps_the_deck_open: show command {command:?}");
out.keep &= run_command(show, doc, now, command, ShowWindow::Audience, zoom);
}
}