Toolbar: the colour chips sit right under the tools again (#3745)
Since the shared docking migration (#3097) the tool column's scroll area filled the toolbar's whole height, so a window taller than the tools pushed the colour chips, Quick Mask and Screen Mode to the bottom. Photoshop keeps them right under the last tool. The scroll area now shrinks to its tools and only a column taller than the window scrolls, with the chips kept at the bottom as before. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
403e321034
commit
986f68f969
|
|
@ -128,9 +128,11 @@ pub fn toolbar(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
|||
+ chips_height(t.pro, t.round_chips, t.round_chips && double)
|
||||
+ if t.pro { 8.0 + if double { bx } else { bx * 2.0 + 3.0 } } else { 0.0 }
|
||||
+ 6.0;
|
||||
// As tall as the tools, so the colour chips sit right under them (Photoshop); a column
|
||||
// taller than the window scrolls and keeps the chips at the bottom.
|
||||
egui::ScrollArea::vertical()
|
||||
.id_salt("toolbar-columns")
|
||||
.auto_shrink([false, false])
|
||||
.auto_shrink([false, true])
|
||||
.max_height((ui.available_height() - footer).max(0.0))
|
||||
.min_scrolled_height(0.0)
|
||||
.show(ui, |ui| {
|
||||
|
|
@ -5234,8 +5236,12 @@ mod compact_visual_regressions {
|
|||
}
|
||||
|
||||
fn toolbar_harness(kind: theme::ThemeKind, scale: f32) -> egui_kittest::Harness<'static, PhotocraftApp> {
|
||||
toolbar_harness_sized(kind, scale, 360.0)
|
||||
}
|
||||
|
||||
fn toolbar_harness_sized(kind: theme::ThemeKind, scale: f32, height: f32) -> egui_kittest::Harness<'static, PhotocraftApp> {
|
||||
let mut ready = false;
|
||||
let mut harness = egui_kittest::Harness::builder().with_size(vec2(400.0, 360.0)).with_pixels_per_point(scale).build_ui_state(
|
||||
let mut harness = egui_kittest::Harness::builder().with_size(vec2(400.0, height)).with_pixels_per_point(scale).build_ui_state(
|
||||
move |ui, app: &mut PhotocraftApp| {
|
||||
if !ready {
|
||||
egui_extras::install_image_loaders(ui.ctx());
|
||||
|
|
@ -5304,6 +5310,18 @@ mod compact_visual_regressions {
|
|||
}
|
||||
}
|
||||
|
||||
/// A window taller than the tools keeps the colour chips right under the last tool, as
|
||||
/// Photoshop does, instead of at the bottom of the toolbar.
|
||||
#[test]
|
||||
fn tall_toolbar_keeps_the_colour_chips_under_the_tools() {
|
||||
for kind in theme::ThemeKind::ALL {
|
||||
let harness = toolbar_harness_sized(kind, 1.0, 1600.0);
|
||||
let last = harness.get_by_label("Zoom Tool (Z)").rect();
|
||||
let swap = harness.get_by_label("Swap colours (X)").rect();
|
||||
assert!(swap.top() - last.bottom() < 80.0, "{kind:?}: the chips {swap:?} sit far below the last tool {last:?}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn capture_compact_visual_fixtures() {
|
||||
let Some(directory) = std::env::var_os("CRAFT_UI_VISUAL_FIXTURES").map(std::path::PathBuf::from) else { return };
|
||||
|
|
|
|||
Loading…
Reference in New Issue