Keep thumbnail strips in one column

This commit is contained in:
Dylan M. Taylor
2026-11-20 13:10:42 -05:00
parent c60d4a7fb2
commit fcc757df4e
2 changed files with 18 additions and 1 deletions
+4 -1
View File
@@ -27,7 +27,7 @@ use super::view::PageSource;
use craft_behavior::{CopyKeys, EditEvent, IconId, MiddleButton, Selection, SelectionChange, SelectionModel as _, keyed};
use craft_ui::contract::{
Bind, CollectionEvent, ContextMenuRequest, DropAt, DropKind, DropPlace, IdSource, NoValue, OsFiles, Outcome, PendingDrop, Props as _,
ReorderMove, ReorderRule, Show as _, ShowCollection as _,
ReorderMove, ReorderRule, Show as _, ShowCollection as _, Sizing,
};
use craft_ui::list::{ThumbAspect, ToggleState};
use craft_ui::primitives::textures::{Priority, ThumbPaint, ThumbRequest, ThumbnailOptions, Thumbnails, texture_side};
@@ -465,6 +465,9 @@ impl<'a> PageThumbnails<'a> {
.picks_beside_current(picks_beside_current)
.groups(&groups)
.tail(&tail);
if !organize {
grid = grid.card_columns(1).sizing(Sizing::Content);
}
if let Some(page) = reveal {
grid = grid.reveal(page);
}
+14
View File
@@ -52,6 +52,20 @@ fn zoomed_grid_requests_a_picture_at_the_drawn_size() {
assert!(side > craft_ui::primitives::textures::ThumbnailOptions::new().max_side as f32, "the zoomed page requested only {side} pixels");
}
/// A wide side panel keeps its page strip in one vertical column.
#[trial]
fn a_wide_thumbnail_strip_keeps_pages_in_one_column() {
let pages = DemoPages::new(3);
let mut picked = Selection::default();
let mut fixture = Fixture::new(move |ui| {
PageThumbnails::new("Pages", &pages, &mut picked, 0, PAPER).show(ui);
});
fixture.room(vec2(500.0, 800.0)).settle();
let first = fixture.by_label("Page 1").expect("first page").rect;
let second = fixture.by_label("Page 2").expect("second page").rect;
assert!(second.top() >= first.bottom(), "the strip stays in page order vertically: {first:?}, {second:?}");
}
/// A click on the New Slide row asks for a new page and goes to no page.
#[trial]
fn the_new_slide_row_asks_for_a_new_page() {