Options bar: Opacity right after Mode in every theme (#9784)

Outside the four Pro themes (Studio, Studio Light, Classic, Solarized
Dark, Adwaita, Adwaita Dark, Breeze Light, Breeze Dark, Soft Dark, Soft
Light), the Brush and Eraser options bar read Size | Mode, Hardness,
Opacity, Flow, so Hardness split Mode from Opacity. Photoshop, and the
Pro bar, put Opacity right after Mode. Hardness now sits beside Size,
before the separator (Size, Hardness | Mode, Opacity, Flow, Smoothing);
it keeps its enabled state (off in the Eraser's Pencil and Block modes)
and the rest of the non-Pro order is unchanged. Pencil and Clone Stamp
already had Opacity after Mode in every theme.

tool_options_theme_tests gains every_theme_puts_opacity_right_after_mode:
for Brush, Eraser, Pencil and Clone Stamp in every ThemeKind, the control
after Mode (by accessible label and rect, left to right) is Opacity, and
outside Pro the Brush and Eraser still show Hardness before Mode. The
Studio Tab test that relied on Hardness and Opacity being neighbours now
tabs from Opacity to Flow, which neighbour in every theme. docs/ui-parity.md
gets a row, a revision-history row and the status line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
ljkxandClaude Opus 5.5 committed 2026-10-28 17:15:49 +01:00
1 parent 1f7fc0f536
commit abdce46337
4 files changed
+50 -10

No files matched your search

+12 -6
View File
@@ -24,12 +24,17 @@ fn harness() -> Harness<'static, PhotocraftApp> {
}
fn geometry(h: &Harness<'_, PhotocraftApp>) -> (Rect, Rect) {
geometry_of(h, "Hardness")
}
/// The `caption` label and the number field right of it.
fn geometry_of(h: &Harness<'_, PhotocraftApp>, caption: &str) -> (Rect, Rect) {
// The visible caption, not the number field it names: kittest returns the labelled control
// for `get_by_label`, whose rect would put the drag inside the numeric editor.
let label = h
.query_all(egui_kittest::kittest::by().label("Hardness").include_labels())
.query_all(egui_kittest::kittest::by().label(caption).include_labels())
.find(|n| n.accesskit_node().role() == egui::accesskit::Role::Label)
.expect("the Hardness caption")
.unwrap_or_else(|| panic!("the {caption} caption"))
.rect();
let field = h
.get_all_by_role(egui::accesskit::Role::SpinButton)
@@ -195,16 +200,17 @@ fn options_gesture_keeps_its_start_owner_when_crossing_regions() {
}
#[test]
fn options_tab_moves_from_hardness_to_opacity_without_a_caption_stop() {
fn options_tab_moves_from_opacity_to_flow_without_a_caption_stop() {
// Opacity and Flow are neighbours in every theme; Hardness sits beside Size outside Pro (#9784).
let mut h = harness();
let (_, f) = geometry(&h);
let (_, f) = geometry_of(&h, "Opacity");
click(&mut h, f.center());
h.key_press(egui::Key::Tab);
h.run_steps(2);
h.key_press(egui::Key::ArrowDown);
h.run_steps(2);
assert_eq!(h.state().session.tools.brush.hardness, 0.5);
assert!((h.state().session.tools.brush.opacity - 0.99).abs() < 0.0001);
assert_eq!(h.state().session.tools.brush.opacity, 1.0);
assert!((h.state().session.tools.brush.flow - 0.99).abs() < 0.0001);
}
// Regression test for #3425: the options bar drew its own 1 px top and bottom separator inside
+4 -3
View File
@@ -216,6 +216,10 @@ fn brush_specific_options(app: &mut PhotocraftApp, ui: &mut egui::Ui, t: Tokens,
opt_label(ui, tl!("Size"));
widgets::value_field(ui, &mut b.size, 1.0..=photocraft_engine::paint::MAX_BRUSH_SIZE, "px", 76.0);
});
// A Pencil-mode Eraser is always hard and at full flow (Photoshop).
let fixed = block || crate::eraser_ui::pencil_mode(app, app.ui.tool);
// Hardness stays with Size, so Opacity follows Mode as in Photoshop and the Pro bar (#9784).
ui.add_enabled_ui(!fixed, |ui| percent_field(ui, tl!("Hardness"), &mut b.hardness, 0.0..=100.0, 66.0));
widgets::vline(ui, 22.0);
if app.ui.tool == Tool::Eraser {
crate::eraser_ui::mode_dropdown(ui, &mut app.ui.tool_options.eraser_mode);
@@ -224,9 +228,6 @@ fn brush_specific_options(app: &mut PhotocraftApp, ui: &mut egui::Ui, t: Tokens,
let held = app.held_erase;
paint_mode_dropdown(ui, "brush-mode", b, &mut app.ui.tool_options.brush_clear, held);
}
// A Pencil-mode Eraser is always hard and at full flow (Photoshop).
let fixed = block || crate::eraser_ui::pencil_mode(app, app.ui.tool);
ui.add_enabled_ui(!fixed, |ui| percent_field(ui, tl!("Hardness"), &mut b.hardness, 0.0..=100.0, 66.0));
ui.add_enabled_ui(!block, |ui| percent_field(ui, tl!("Opacity"), &mut b.opacity, 0.0..=100.0, 66.0));
ui.add_enabled_ui(!fixed, |ui| percent_field(ui, tl!("Flow"), &mut b.flow, 1.0..=100.0, 66.0));
opt_label(ui, tl!("Smoothing"));
@@ -95,3 +95,34 @@ fn every_theme_shows_the_crop_options() {
assert!(h.state().ui.tool_options.crop_ratio.is_empty(), "{theme:?}: Clear empties the ratio");
}
}
/// The bar's controls (not their captions) as `(label, rect)`, left to right.
fn controls_in_order(h: &Harness<'_, PhotocraftApp>) -> Vec<(String, egui::Rect)> {
let mut v: Vec<(String, egui::Rect)> = h
.root()
.children_recursive()
.filter(|n| n.accesskit_node().role() != egui::accesskit::Role::Label)
.filter_map(|n| Some((n.accesskit_node().label()?.trim_end_matches(':').to_string(), n.rect())))
.collect();
v.sort_by(|a, b| a.1.left().total_cmp(&b.1.left()));
v
}
/// #9784: Photoshop's painting tools show Opacity right after Mode, as the Pro themes do. The
/// other themes used to put Hardness between them for the Brush and Eraser.
#[test]
fn every_theme_puts_opacity_right_after_mode() {
for tool in [Tool::Brush, Tool::Eraser, Tool::Pencil, Tool::CloneStamp] {
for theme in ThemeKind::ALL {
let found = controls_in_order(&options_bar(theme, tool));
let names: Vec<&str> = found.iter().map(|(l, _)| l.as_str()).collect();
let mode = names.iter().position(|l| *l == "Mode").unwrap_or_else(|| panic!("{theme:?} {tool:?}: no Mode control in {names:?}"));
assert_eq!(names.get(mode + 1), Some(&"Opacity"), "{theme:?} {tool:?}: Opacity follows Mode in {names:?}");
assert!(found[mode].1.right() <= found[mode + 1].1.left(), "{theme:?} {tool:?}: Mode and Opacity don't overlap: {found:?}");
if matches!(tool, Tool::Brush | Tool::Eraser) && !crate::theme::Tokens::for_kind(theme).pro {
let hardness = names.iter().position(|l| *l == "Hardness");
assert!(hardness.is_some_and(|i| i < mode), "{theme:?} {tool:?}: Hardness stays, beside Size: {names:?}");
}
}
}
}
+3 -1
View File
@@ -1,6 +1,6 @@
# UI parity: tools, handles, modifiers and feel
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-27 · **Change:** minor (New Group dialog and button modifiers; new layers go into an open active group and join a clipping mask, except that type, shapes, pastes and placed files go above a group whose lock would refuse them; Color panel Hue and Brightness Cube show the out-of-gamut ⚠ and nearest printable colour when the field is at least 53 pt tall, #8672; 12 of 181 preferences do nothing, from the scorecard; Art History Brush in the History group of the Y flyout, partial, TOOL-213-20, #1610; Histogram panel: Compact / Expanded / All Channels views, Luminosity and Colors channels, Source, range statistics, Uncached Refresh, live adjustment overlay, Cache Levels preference; the font menu opens on the current family, marked in the recent group when it is a recent one, #9160; Type options bar alignment and direction follow the target paragraph; a swatch click recolours selected type and shape layers with any tool, #9238; UI scale presets done: 105–120% steps, #3222; ⇧⌥ blend mode letters; painting tool Mode menus; ⌥ + 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; Properties › Transform shows a shape's path geometry, without its stroke) · **Target:** Adobe Photoshop 2026
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-28 · **Change:** minor (painting tools' options bar shows Opacity right after Mode in every theme, #9784; New Group dialog and button modifiers; new layers go into an open active group and join a clipping mask, except that type, shapes, pastes and placed files go above a group whose lock would refuse them; Color panel Hue and Brightness Cube show the out-of-gamut ⚠ and nearest printable colour when the field is at least 53 pt tall, #8672; 12 of 181 preferences do nothing, from the scorecard; Art History Brush in the History group of the Y flyout, partial, TOOL-213-20, #1610; Histogram panel: Compact / Expanded / All Channels views, Luminosity and Colors channels, Source, range statistics, Uncached Refresh, live adjustment overlay, Cache Levels preference; the font menu opens on the current family, marked in the recent group when it is a recent one, #9160; Type options bar alignment and direction follow the target paragraph; a swatch click recolours selected type and shape layers with any tool, #9238; UI scale presets done: 105–120% steps, #3222; ⇧⌥ blend mode letters; painting tool Mode menus; ⌥ + 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; Properties › Transform shows a shape's path geometry, without its stroke) · **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,
@@ -234,6 +234,7 @@ Paragraph; the rest open as in-app floating windows.
| UI scale presets | done | UI-217-9; 75–125% in 5% steps (#2492, #3222) |
| History snapshots: camera button, New Snapshot dialog (⌥-click: Name, From), the first snapshot (the document as opened), snapshot rows (click returns and selects, rename, delete; the trash deletes the selected snapshot, and a snapshot or state dragged onto it, #5324), `history.*Snapshot` commands | partial | `history_cmds.rs`, `snapshot_rows` in `panels.rs`, `snapshot_dialog.rs`; the snapshot History Options and History Brush sources to come (#2966) |
| Themes: Photoshop's four greys | partial | five themes; #2661 |
| Painting tools' options bar: Opacity right after Mode in every theme (Brush, Pencil, Eraser, Clone Stamp); the non-Pro themes keep Hardness beside Size | done | #9784, `tool_options_theme_tests.rs::every_theme_puts_opacity_right_after_mode` |
| Document tabs: overflow, context menu, reorder | done | UI-217-6; middle-click close #2570 |
| Layers panel: wheel steps blend modes, drop on New/Trash | partial | UI-217-14 |
| Layers panel New Group button: click with 2+ layers selected groups them (CC 2014+), ⇧-click groups, one layer gives an empty group, ⌥-click opens the New Group dialog, ⌘-click adds the group below the active layer | done | #2561, `new_group_button_tests.rs` |
@@ -252,6 +253,7 @@ Paragraph; the rest open as in-app floating windows.
| Date | Change | Summary |
|---|---|---|
| 2026-10-28 | minor | Brush and Eraser options bar outside the Pro themes: Hardness moved beside Size, so Opacity follows Mode in every theme, as in Photoshop and the Pro bar (#9784). Scores unchanged. |
| 2026-10-27 | minor | Every preference takes effect: 12 of 181 do nothing, the scorecard's count with integration batch 9 (#9775) on main; new layers go above a group whose lock would refuse them (#4329) |
| 2026-10-25 | minor | Every preference takes effect: 12 of 178 do nothing, the scorecard's count (it still said 46 of 149) |
| 2026-10-25 | minor | Art History Brush is in the History group of the Y flyout (partial, TOOL-213-20, #1610) |