From ecbd3d78be0892c0fbe80ebc99cc2fb0a1d6ac75 Mon Sep 17 00:00:00 2001 From: ngrafton2006 <50221354+ngrafton2006@users.noreply.github.com> Date: Sun, 11 Oct 2026 08:28:38 -0400 Subject: [PATCH] Toolbar: Pro themes draw tool glyphs at two thirds of the button (#2665) (#2932) The Pro toolbar drew each tool glyph at 16 px in a 30 px button (the generic icon-button proportion), which reads small and thin next to Photoshop's toolbar. Pro themes now draw tool glyphs at 20 px; the other themes keep the icon-button size. Claude-Session: https://claude.ai/code/session_01CVtZHu998NDhf4Z8QvS5pd Co-authored-by: ngrafton2006 Co-authored-by: Claude Opus 5.5 Co-authored-by: Brandon Thomas --- crates/ui-egui/src/panels.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index 6fc11515fe..bde5b84bbc 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -148,7 +148,7 @@ pub fn toolbar(app: &mut PhotocraftApp, ui: &mut egui::Ui) { let sel = slot.contains(&app.ui.tool); let tip = if tool.key() == '\0' { tl!(tool.label()).to_string() } else { format!("{} ({})", tl!(tool.label()), tool.key()) }; - let resp = icons::button(ui, icons::tool_icon(tool), bx, sel, &tip); + let resp = icons::button_with_icon_size(ui, icons::tool_icon(tool), bx, toolbar_icon_size(bx, t.pro), sel, &tip); if slot.len() > 1 { paint_toolbar_flyout_indicator(ui, &t, &resp); } @@ -309,6 +309,12 @@ pub fn toolbar(app: &mut PhotocraftApp, ui: &mut egui::Ui) { ); } +/// Glyph size of a toolbar tool button. Pro fills two thirds of the button, close to Photoshop's +/// toolbar glyphs (#2665); the other themes keep the general icon-button proportion. +fn toolbar_icon_size(box_size: f32, pro: bool) -> f32 { + (box_size * if pro { 2.0 / 3.0 } else { 0.52 }).round() +} + /// Paints a triangle on the bottom right corner of an icon button to indicate that a toolbar item has a submenu. pub fn paint_toolbar_flyout_indicator(ui: &mut egui::Ui, tokens: &Tokens, resp: &egui::Response) { let r = resp.rect; @@ -4268,6 +4274,15 @@ mod type_flyout_tests { assert_eq!(*hand, [Tool::Hand, Tool::RotateView]); assert_eq!(Tool::RotateView.key(), 'R'); } + + #[test] + fn pro_toolbar_glyphs_fill_two_thirds_of_the_button() { + // #2665: Photoshop-style themes draw tool glyphs larger than other icon buttons. + assert_eq!(toolbar_icon_size(30.0, true), 20.0); + assert_eq!(toolbar_icon_size(36.0, false), (36.0f32 * 0.52).round(), "other themes keep the icon-button size"); + // The glyph stays inside the button with room for the flyout triangle's corner. + assert!(toolbar_icon_size(30.0, true) <= 30.0 - 2.0 * 4.0); + } } #[cfg(test)]