mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-25 20:14:31 +01:00
Merge branch 'red/rf-gallery' into area/ribbon-fw
This commit is contained in:
commit
be36cd7205
2 files changed
+16
-4
No files matched your search
@@ -1,5 +1,8 @@
|
||||
//! Stories of the in-ribbon gallery.
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use craft_host::InlineJobs;
|
||||
use craft_ui::contract::Show as _;
|
||||
use craft_ui::primitives::textures::Revision;
|
||||
use craft_ui::primitives::{FakeThumbSource, Thumbnails, ThumbnailOptions};
|
||||
@@ -98,8 +101,11 @@ fn gallery_painted(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(Gallery<'static, usize>, covers = [], drive = Drive::Never)]
|
||||
fn gallery_rendered(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
||||
// The source renders as a `Later` job: each tile shows the store's placeholder, then its picture.
|
||||
let thumbnails = Thumbnails::<u64>::in_context(ui.ctx(), "craft_menu.gallery.story", ThumbnailOptions::new());
|
||||
// The source renders as a `Later` job: each tile shows the store's placeholder, then its picture. The jobs run
|
||||
// inline, so the pictures land in the next frame and not whenever a thread ends: the suite's settled frames are
|
||||
// the same on every run.
|
||||
let options = ThumbnailOptions::new().jobs(Arc::new(InlineJobs));
|
||||
let thumbnails = Thumbnails::<u64>::in_context(ui.ctx(), "craft_menu.gallery.story", options);
|
||||
let source = FakeThumbSource::<u64>::new().later(true);
|
||||
let items: Vec<GalleryItem<'_, usize>> = (0..COUNT)
|
||||
.map(|at| GalleryItem { key: at, label: name(at), face: GalleryFace::Rendered { key: at as u64, thumbnails: &thumbnails, source: &source } })
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
//! Stories of `Picture`.
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use craft_host::InlineJobs;
|
||||
|
||||
use super::{Picture, PictureSize};
|
||||
use crate::contract::Show as _;
|
||||
use crate::list::{ThumbAspect, ThumbSize};
|
||||
@@ -32,10 +36,12 @@ fn picture_thumbnail(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
||||
}
|
||||
|
||||
/// A picture made off the frame: its source renders as a `Later` job, so the picture shows the placeholder until the
|
||||
/// job lands on the loader's lanes, then the picture.
|
||||
/// job lands on the loader's lanes, then the picture. The job runs inline, so the picture lands in the next frame and
|
||||
/// not whenever a thread ends: the suite's settled frames are the same on every run.
|
||||
#[story(Picture<'static>, covers = [], drive = Drive::Never)]
|
||||
fn picture_rendered(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
||||
let thumbnails = Thumbnails::<u64>::in_context(ui.ctx(), "craft_ui::stories::picture_rendered", ThumbnailOptions::new());
|
||||
let options = ThumbnailOptions::new().jobs(Arc::new(InlineJobs));
|
||||
let thumbnails = Thumbnails::<u64>::in_context(ui.ctx(), "craft_ui::stories::picture_rendered", options);
|
||||
let source = FakeThumbSource::<u64>::new().later(true).opaque(true);
|
||||
Picture::rendered("Rendered", 1, &thumbnails, &source).extent(PictureSize::Thumb(ThumbSize::Large)).show(ui).into()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user