mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-27 08:15:03 +00:00
Keep thumbnail strips in one column
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user