mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-21 01:18:43 +00:00
Keep unmatched font searches compact and readable
This commit is contained in:
1 parent
7996987dfd
commit
b3f6e4e95b
3 files changed
+50
-4
No files matched your search
@@ -109,6 +109,36 @@ fn empty_or_unmatched_input_applies_nothing_and_escape_restores_the_name() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_matching_fonts_shows_a_compact_message_and_clearing_restores_the_list() {
|
||||
for preview in [FontPreview::Off, FontPreview::Medium, FontPreview::ExtraLarge] {
|
||||
let mut h = harness_with(preview);
|
||||
open(&mut h);
|
||||
let full = popup_rect(&h).expect("full menu open");
|
||||
let field = h.get_by_role(Role::TextInput).rect();
|
||||
h.get_by_role(Role::TextInput).type_text("fdsfdsfds");
|
||||
h.run();
|
||||
let empty = popup_rect(&h).expect("unmatched input keeps the menu open");
|
||||
assert!(empty.width() >= field.width(), "{preview:?}: empty popup collapsed to {empty:?}");
|
||||
assert!(empty.height() < full.height() / 4.0, "{preview:?}: empty popup retained the full height: {empty:?} vs {full:?}");
|
||||
assert!(empty.contains(h.get_by_label("No matching fonts").rect().center()));
|
||||
assert_eq!(h.state().current, "Family 00");
|
||||
h.key_press(Key::ArrowDown);
|
||||
h.key_press(Key::ArrowUp);
|
||||
h.key_press(Key::Enter);
|
||||
h.run();
|
||||
assert_eq!(h.state().current, "Family 00", "empty-result navigation applies nothing");
|
||||
h.key_press_modifiers(Modifiers::COMMAND, Key::A);
|
||||
h.key_press(Key::Backspace);
|
||||
h.run();
|
||||
let restored = popup_rect(&h).expect("clearing restores the list");
|
||||
assert!(h.query_by_label("No matching fonts").is_none());
|
||||
assert!(h.query_by_label("Family 01").is_some());
|
||||
assert!((restored.width() - full.width()).abs() < 0.5, "{preview:?}: width {restored:?} != {full:?}");
|
||||
assert!((restored.height() - full.height()).abs() < 0.5, "{preview:?}: height {restored:?} != {full:?}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn clicking_elsewhere_discards_unaccepted_input() {
|
||||
let mut h = harness();
|
||||
@@ -1114,7 +1144,8 @@ fn capture_font_field_gpu_visual_fixtures() {
|
||||
for width in [140.0, 170.0] {
|
||||
let mut h = Harness::builder().with_size(vec2(420.0, 560.0)).with_pixels_per_point(scale).wgpu().build_ui_state(
|
||||
move |ui, current: &mut String| {
|
||||
let families = ["Arial", "Consolas", "Inter", "JetBrains Mono"].map(str::to_string);
|
||||
let mut families: Vec<String> = ["Arial", "Consolas", "Inter", "JetBrains Mono"].map(str::to_string).into();
|
||||
families.extend((0..60).map(|i| format!("Z Fixture Family {i:02}")));
|
||||
font_picker_in(ui, current, width, &families, FontPreview::Medium, &[]);
|
||||
},
|
||||
"Inter".to_string(),
|
||||
@@ -1130,6 +1161,14 @@ fn capture_font_field_gpu_visual_fixtures() {
|
||||
h.event(egui::Event::Text("C".into()));
|
||||
h.run();
|
||||
h.render().unwrap().save(directory.join(format!("{stem}-filtered.png"))).unwrap();
|
||||
h.key_press_modifiers(Modifiers::COMMAND, Key::A);
|
||||
h.event(egui::Event::Text("fdsfdsfds".into()));
|
||||
h.run();
|
||||
h.render().unwrap().save(directory.join(format!("{stem}-no-matches.png"))).unwrap();
|
||||
h.key_press_modifiers(Modifiers::COMMAND, Key::A);
|
||||
h.key_press(Key::Backspace);
|
||||
h.run();
|
||||
h.render().unwrap().save(directory.join(format!("{stem}-cleared.png"))).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1885,7 +1885,14 @@ pub(crate) fn family_picker_in(
|
||||
// The name is outside the popup: clicking it to move the caret keeps the list open.
|
||||
let close = if input.contains_pointer() { egui::PopupCloseBehavior::IgnoreClicks } else { egui::PopupCloseBehavior::CloseOnClickOutside };
|
||||
let response = crate::press_menu::show_with_close_behavior(&anchor, close, |ui, press| {
|
||||
// Rows normally size the popup. With no matches, keep a readable width and omit
|
||||
// the cached scroll viewport so an empty list cannot become a tall, narrow bar.
|
||||
ui.set_min_width(width.max(330.0));
|
||||
let (rows, n_recent) = font_menu_rows(families, labels, &edit.query, &edit.recents);
|
||||
if rows.is_empty() {
|
||||
ui.weak(tl!("No matching fonts"));
|
||||
return None;
|
||||
}
|
||||
let mut selected = edit
|
||||
.row
|
||||
.filter(|&i| rows.get(i).is_some_and(|(f, _)| *f == current))
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
# UI parity: tools, handles, modifiers and feel
|
||||
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-25 · **Change:** minor (direct font-name editing in shared Type controls, #9338; ⌥ + an adjustment's shortcut reopens it at its last settings, ⌥⌘L / ⌥⌘M, #8900; Crop default mode: moving the image under the box snaps the frame's edges and centre, #8580; View › Extras hides the Move transform controls, #6699; adjustment clipping stays visible in compact Properties, #5231; Color panel modes from its panel menu, the same in every theme, UI-217-17, #6000; a picked colour recolours the selected type and shapes; Hand tool ⌘ / ⌥ are Zoom In / Zoom Out while held, #6434; the wheel steps value fields, #5473; a dragged guide shows its X or Y beside the pointer, #7680; Type options bar "T" icon scrubs the font size, #6437; Move tool: dragged selected pixels take their own outline as the selection, #7538; artboard backgrounds remain below child Free Transform previews; ⌫/Delete removes the selected smart filter, #4751; Object Finder foreground/background discrimination (#6548); rounded triangle, polygon and star corners; shape Fill/Stroke popovers accept hex RGB values, #6176; a guide let go over either ruler is removed, #6286; Crop rows corrected: saved crop presets and Delete Cropped Pixels off are done, #6562; marching ants in device pixels, #7489; Animated Zoom: holding the Zoom tool zooms continuously, #6210; shape Density and Feather, TOOL-214-12, #5846; Pen Auto Add/Delete on the path being drawn, #6140; Show Transform Controls frames every selected layer; guide keys and clicks; menu bar from the keyboard, #4988; Crop tool Content-Aware Fill; on-canvas corner radius widgets, TOOL-214-12; Curvature Pen edits the active path; Clip Thumbnails to Layer Bounds; Pen ⇧ 45°; last selected tool restored at launch; Layers panel filter-type dropdown with Kind, Name and Mode, #5048; Free Transform box and marching ants follow the selection, #5297; History: the trash deletes the selected snapshot, rows drag onto the trash, #5324; smart filter reordering by drag; smart object perspective row corrected to done, #426; Free Transform H/V skew fields; toolbar tool shortcuts can be reassigned; ⇧-dragged guides land on ruler ticks; layer and selection keys; tool keys; spring-loaded tool letters; type formatting keys; Pen Auto Add/Delete, #4144; smart filter rows; stale missing-tool rows corrected: Color Replacement, Red Eye and the Add/Delete Anchor Point pair are live toolbar tools, Frame landed; no percentage changed; selection-modifier and ⌥-wheel rows match their tests) · **Target:** Adobe Photoshop 2026
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-25 · **Change:** minor (direct font-name editing in shared Type controls with a compact no-match message, #9338; ⌥ + an adjustment's shortcut reopens it at its last settings, ⌥⌘L / ⌥⌘M, #8900; Crop default mode: moving the image under the box snaps the frame's edges and centre, #8580; View › Extras hides the Move transform controls, #6699; adjustment clipping stays visible in compact Properties, #5231; Color panel modes from its panel menu, the same in every theme, UI-217-17, #6000; a picked colour recolours the selected type and shapes; Hand tool ⌘ / ⌥ are Zoom In / Zoom Out while held, #6434; the wheel steps value fields, #5473; a dragged guide shows its X or Y beside the pointer, #7680; Type options bar "T" icon scrubs the font size, #6437; Move tool: dragged selected pixels take their own outline as the selection, #7538; artboard backgrounds remain below child Free Transform previews; ⌫/Delete removes the selected smart filter, #4751; Object Finder foreground/background discrimination (#6548); rounded triangle, polygon and star corners; shape Fill/Stroke popovers accept hex RGB values, #6176; a guide let go over either ruler is removed, #6286; Crop rows corrected: saved crop presets and Delete Cropped Pixels off are done, #6562; marching ants in device pixels, #7489; Animated Zoom: holding the Zoom tool zooms continuously, #6210; shape Density and Feather, TOOL-214-12, #5846; Pen Auto Add/Delete on the path being drawn, #6140; Show Transform Controls frames every selected layer; guide keys and clicks; menu bar from the keyboard, #4988; Crop tool Content-Aware Fill; on-canvas corner radius widgets, TOOL-214-12; Curvature Pen edits the active path; Clip Thumbnails to Layer Bounds; Pen ⇧ 45°; last selected tool restored at launch; Layers panel filter-type dropdown with Kind, Name and Mode, #5048; Free Transform box and marching ants follow the selection, #5297; History: the trash deletes the selected snapshot, rows drag onto the trash, #5324; smart filter reordering by drag; smart object perspective row corrected to done, #426; Free Transform H/V skew fields; toolbar tool shortcuts can be reassigned; ⇧-dragged guides land on ruler ticks; layer and selection keys; tool keys; spring-loaded tool letters; type formatting keys; Pen Auto Add/Delete, #4144; smart filter rows; stale missing-tool rows corrected: Color Replacement, Red Eye and the Add/Delete Anchor Point pair are live toolbar tools, Frame landed; no percentage changed; selection-modifier and ⌥-wheel rows match their tests) · **Target:** Adobe Photoshop 2026
|
||||
|
||||
How PhotoCraft's direct manipulation compares with Photoshop 2026 (27.11.0): the toolbox, the
|
||||
handles and modifier keys of each gesture, nudging, snapping, numeric precision, navigation,
|
||||
@@ -171,7 +171,7 @@ Triangle and Curvature Pen (minus legacy Rounded Rectangle and Targeted Adjustme
|
||||
| Geometry precision | partial | `geom::Point` f64, paths f64; paint internals mostly f32 |
|
||||
| Numeric fields: arithmetic, scrubby labels | partial | units in expressions and double-click reset missing (UI-217-13) |
|
||||
| Wheel steps a value field, ⇧ ×10: clicked into, wherever the pointer is; not clicked, a gesture that starts over it | partial | `field_wheel.rs` (#5473, #4061). Photoshop: a field takes the wheel once clicked into (shortcut guides, user reports); whether the pointer must stay over it is unconfirmed. Stepping on hover alone is Photopea's, kept deliberately |
|
||||
| Font-name field: click selects the full name; typing searches in place | done | `type_tool.rs` `family_picker_in`, `type_font_picker_tests.rs` (#9338): one editable name above the list; Enter or a row accepts; Escape/outside click discards pending text; existing navigation and previews retained |
|
||||
| Font-name field: click selects the full name; typing searches in place | done | `type_tool.rs` `family_picker_in`, `type_font_picker_tests.rs` (#9338): one editable name above the list; unmatched queries show a compact message; Enter or a row accepts; Escape/outside click discards pending text; existing navigation and previews retained |
|
||||
| Type options bar: drag the "T" icon to change the font size | done | `type_tool.rs` `options_bar`: the icon scrubs the size field like the Character panel's icons (Shift x10, Alt fine), at layer or selection scope, one history step per drag, within 1–1296 pt (#6437) |
|
||||
|
||||
## Navigation
|
||||
@@ -301,4 +301,4 @@ Paragraph; the rest open as in-app floating windows.
|
||||
| 2026-10-14 | minor | A colour picked in the Color or Swatches panel or the Color Picker recolours the selected type layers (Type tool) or shape fills (shape, Pen and path selection tools) |
|
||||
| 2026-10-15 | minor | Color panel: Photoshop's panel-menu modes, colour ramp and copy commands; the theme no longer picks the panel's layout (UI-217-17 done, #2569, #6000) |
|
||||
| 2026-10-23 | minor | ⌥ + an adjustment's shortcut (⌥⌘L Levels, ⌥⌘M Curves) opens its dialog at the settings of its last OK, as in Photoshop (#8900); no percentage changed |
|
||||
| 2026-10-25 | minor | Shared font-family fields support direct name editing and search, with full-name selection on entry, explicit acceptance and cancellation (#9338); no percentage changed |
|
||||
| 2026-10-25 | minor | Shared font-family fields support direct name editing and search, with full-name selection on entry, explicit acceptance and cancellation, plus a compact no-match result (#9338); no percentage changed |
|
||||
Reference in new issue
Block a user