mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 02:09:00 +00:00
Brush Preset picker: a rename request runs the view that takes it, the picker opens in its search field, a memoized view keeps its body's column
- Collection requests are a tracked input: request_rename moves it and the item step that takes the request reads it, so a pending request runs the memoized view that takes it. - A preset picker opens with the focus in its search field (the browser's search field is the popover's default stop), so its head and list replay while it is open and idle; without a search field, on its first stop. - A memoized view's layout room keeps whether its body is a content-sized or a given column, as it keeps the content axes: a rule that fills the width in a view in a content-sized popover took the open room, not the popover's width. - Trials: a request runs the taking view once; a view in a popover fills its width as without the view. The escape revert trial edits roundness by dragging a dot (a press on the tip widget takes no focus).
This commit is contained in:
@@ -226,7 +226,8 @@ impl Opened {
|
||||
/// brush live and report [`BrushPresetPickerOutput::tip`], [`diameter`](BrushPresetPickerOutput::diameter) and
|
||||
/// [`hardness`](BrushPresetPickerOutput::hardness).
|
||||
/// - **Search row.** The browser's search field (any letter case, groups open while filtering) unless Show Search
|
||||
/// Bar is off, then at its reading end the Brush Settings and New Brush Preset buttons and the gear.
|
||||
/// Bar is off, then at its reading end the Brush Settings and New Brush Preset buttons and the gear. The popover
|
||||
/// opens with the focus in the search field, so typing filters the presets.
|
||||
/// - **Gear menu.** New Brush Preset…; Rename Brush… (opens the name field on the current preset) and Delete Brush…
|
||||
/// (enabled with a current preset); the Brush Name, Brush Stroke and Brush Tip boxes (at least one stays on); Show
|
||||
/// Search Bar; Import Brushes… with [`import`](Self::import). The app adds its own rows to each section with
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//! roundness; Escape reverts the head's edits.
|
||||
|
||||
use craft_draw::ui::brush_presets::{BrushCardParts, BrushPick, BrushPickerState, BrushPickerValues, BrushPresetPicker, BrushRowPaint, brush_row};
|
||||
use craft_draw::ui::brush_settings::TipAngle;
|
||||
use craft_draw::ui::brush_settings::{TipAngle, ellipse_handles};
|
||||
use craft_ui::contract::{Bind, Role, SaveKey};
|
||||
use craft_ui::patterns::presets::{PresetEvent, PresetFns, PresetRow, PresetSource};
|
||||
use craft_ui::runtime::env::Env;
|
||||
@@ -208,7 +208,11 @@ fn escape_reverts_size_hardness_angle_and_roundness() {
|
||||
let (mut fixture, host) = opened_rig(true, false);
|
||||
let tip = fixture.by_label("Tip angle and roundness").expect("the angle widget shows");
|
||||
fixture.click_at(tip.rect.center() + Vec2::new(tip.rect.width() / 4.0, -tip.rect.height() / 4.0));
|
||||
fixture.key(Key::ArrowDown, Modifiers::ALT);
|
||||
fixture.idle(2);
|
||||
// A roundness dot dragged halfway to the centre squashes the ellipse. The ellipse spans most of the disc.
|
||||
let turned = host.borrow().values.tip.expect("the tip shows");
|
||||
let dot = ellipse_handles(turned, tip.rect.width().min(tip.rect.height()) / 2.0 * 0.85)[0];
|
||||
fixture.drag_at(tip.rect.center() + dot, -dot / 2.0);
|
||||
for label in ["Size", "Hardness"] {
|
||||
let slider = fixture.by_role(Role::SLIDER).into_iter().find(|target| fixture.tree().name_of(target.node) == Some(label));
|
||||
let slider = slider.unwrap_or_else(|| panic!("the {label} slider shows"));
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
//! Requests to a collection's item step from outside it, taken at the collection's next pass.
|
||||
//! Requests to a collection's item step from outside it, taken at the collection's next pass. Each request moves the
|
||||
//! `Requests` input and each take reads it, so a pending request runs the memoized view that takes it.
|
||||
|
||||
use crate::runtime::egui::memory as store;
|
||||
use crate::runtime::inputs::{self, Input};
|
||||
use egui::{Context, Id};
|
||||
|
||||
/// The rename requests not yet taken: the collection and the key to rename.
|
||||
@@ -24,11 +26,13 @@ pub fn request_rename<K: Clone + Send + Sync + 'static>(ctx: &Context, collectio
|
||||
requests.0.retain(|(id, _)| *id != collection);
|
||||
requests.0.push((collection, key.clone()));
|
||||
});
|
||||
inputs::bump(ctx, Input::Requests);
|
||||
crate::runtime::egui::repaint::request_of(ctx, crate::runtime::egui::pass::current_viewport(ctx));
|
||||
}
|
||||
|
||||
/// The rename request addressed to `collection`, once.
|
||||
pub(super) fn take_rename<K: Send + Sync + 'static>(ctx: &Context, collection: Id) -> Option<K> {
|
||||
crate::runtime::replay::note_input(ctx, Input::Requests);
|
||||
store::Service::<RenameRequests<K>>::run(ctx, |requests| {
|
||||
let at = requests.0.iter().position(|(id, _)| *id == collection)?;
|
||||
Some(requests.0.remove(at).1)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
use super::lazy::{Lazy, Shown};
|
||||
use super::memo::{MemoKey, MemoProps};
|
||||
use crate::runtime::env::Env;
|
||||
use crate::runtime::env::{Env, Scoped};
|
||||
use crate::runtime::shift::Shift;
|
||||
use egui::Ui;
|
||||
use std::fmt;
|
||||
@@ -44,8 +44,8 @@ use std::sync::Arc;
|
||||
/// - what the scope around it hands down beyond those (enabled, read-only, size, ink, the command chain, motion, every
|
||||
/// app value, and the rest of `Scoped::scope_key`), in the key;
|
||||
/// - the framework inputs it reads outside its props (`runtime::inputs`: the modifiers, the pointer, the keys held, the
|
||||
/// window facts, the keyboard layout, the keymap, a drag, the focus, the open layers, the scroll view of a nested
|
||||
/// `Lazy`): a change of one runs only the views that read it;
|
||||
/// window facts, the keyboard layout, the keymap, a drag, the focus, the open layers, the requests to collections,
|
||||
/// the scroll view of a nested `Lazy`): a change of one runs only the views that read it;
|
||||
/// - the clock, read through `frame::stepped_clock`: the view runs at the next step;
|
||||
/// - commands sent to a command scope instance inside it: it runs while one waits.
|
||||
///
|
||||
@@ -103,17 +103,10 @@ impl<P: MemoProps, R: Clone + PartialEq + Shift + Send + Sync + 'static> MemoVie
|
||||
let env = Env::of(ui);
|
||||
let key = Self::key(&ctx, &env, &props, show);
|
||||
let shown = lazy.run_keyed(ui, std::any::type_name::<P>(), crate::runtime::lazy::Key::Memo(key), |ui, run| {
|
||||
// The content is a layout room of its own: the flow of the body around it does not reach in. It keeps the
|
||||
// axes that body sizes from its content, so the view takes what its content used there, as the same
|
||||
// content shown without the view would: a child that fills takes its measured size, never the open room.
|
||||
let installed = Env::install_for(
|
||||
ui,
|
||||
env.derive_local(|scoped| {
|
||||
let content = scoped.content;
|
||||
scoped.start_room();
|
||||
scoped.content = content;
|
||||
}),
|
||||
);
|
||||
// The content is a layout room of its own: the flow of the body around it does not reach in. It keeps how
|
||||
// that body sizes from its content, so the view takes what its content used there, as the same content
|
||||
// shown without the view would.
|
||||
let installed = Env::install_for(ui, env.derive_local(Scoped::start_view_room));
|
||||
let out = show(&mut props, ui);
|
||||
Env::restore(&ctx, installed);
|
||||
run.output = Some(Arc::new(out.clone()));
|
||||
|
||||
@@ -394,12 +394,22 @@ impl Scoped {
|
||||
self.offered = None;
|
||||
}
|
||||
|
||||
/// Starts a memoized view's layout room (`start_room`), keeping whether the enclosing body is a content-sized or a
|
||||
/// given column, as `start_room` keeps the content axes. The view's content then measures and fills as it would
|
||||
/// shown without the view: a child that fills takes its measured size where the body sizes from content, never the
|
||||
/// open room.
|
||||
pub(crate) fn start_view_room(&mut self) {
|
||||
let (content_column, given_column) = (self.content_column, self.given_column);
|
||||
self.start_room();
|
||||
(self.content_column, self.given_column) = (content_column, given_column);
|
||||
}
|
||||
|
||||
/// The key of everything a memoized view shown in this scope inherits beyond `key` (the style inputs, which its
|
||||
/// place compares): the scope's state (enabled, read-only, size, glyphs, ink, surface, wheel, directions), the
|
||||
/// containers around it (arena, roving group, transform, collection item and row, inside label, footer slot, line
|
||||
/// length, scroll owner and axes), the command chain, motion, the host's formats and date, and every app value. Of
|
||||
/// the flow fields of the enclosing body only the axes it sizes from its content are in it: a memoized view's
|
||||
/// content starts a layout room of its own (`start_room`) that keeps those axes. Computed once per scope, on the
|
||||
/// the flow fields of the enclosing body only how it sizes from its content is in it: a memoized view's content
|
||||
/// starts a layout room of its own (`start_view_room`) that keeps those facts. Computed once per scope, on the
|
||||
/// first view that asks; the bytes it fed are counted then.
|
||||
pub(crate) fn scope_key(&self) -> u128 {
|
||||
*self.scope_key.get_or_init(|| {
|
||||
@@ -407,6 +417,7 @@ impl Scoped {
|
||||
let mut key = MemoKey::of_view(&self.ctx);
|
||||
key.feed_hash(&(self.enabled, self.read_only, self.size, self.glyphs, self.ink, self.surface, self.wheel));
|
||||
key.feed_hash(&(self.direction, self.text_direction, self.ids_stable, self.cell_fills, self.least, self.unbounded, self.content));
|
||||
key.feed_hash(&(self.content_column, self.given_column));
|
||||
key.feed_hash(&(self.arena, self.roving, self.item, self.row, self.scroll_owner.map(|owner| (owner.id, owner.view))));
|
||||
self.transform.map(|transform| (transform.scale, transform.offset)).key(&mut key);
|
||||
self.footer_slot.map(|slot| (slot.owner, slot.size)).key(&mut key);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
//! Tracked inputs: the framework inputs a view can read outside its props (the modifiers, the pointer, the window's
|
||||
//! facts, the keyboard layout, the keymap, a drag, the focus, the open layers, the keys held), each with a generation
|
||||
//! facts, the keyboard layout, the keymap, a drag, the focus, the open layers, the keys held, the requests to
|
||||
//! collections), each with a generation
|
||||
//! that moves when its value changes. The accessor that reads one notes it into the records open around the running
|
||||
//! code (`replay::note_input`); a memoized view's replay is refused when an input its run read has another generation
|
||||
//! now (`runtime::lazy::settled`), so a change runs only the views that read it, and a view absent while it changed
|
||||
@@ -34,12 +35,15 @@ pub(crate) enum Input {
|
||||
Focus,
|
||||
/// The layers shown last frame (`overlay::is_open`, `any_open`, `top`, `family`, `entry`).
|
||||
Overlays,
|
||||
/// The requests to collections from outside them (`items::request_rename`), read by the item step that takes
|
||||
/// them, so a pending request runs the view that takes it.
|
||||
Requests,
|
||||
/// The view of the scroll area a nested `Lazy` child decides by. No generation: compared by value.
|
||||
Scroll,
|
||||
}
|
||||
|
||||
impl Input {
|
||||
pub(crate) const ALL: [Input; 10] = [
|
||||
pub(crate) const ALL: [Input; 11] = [
|
||||
Input::Modifiers,
|
||||
Input::Pointer,
|
||||
Input::Keys,
|
||||
@@ -49,6 +53,7 @@ impl Input {
|
||||
Input::Drag,
|
||||
Input::Focus,
|
||||
Input::Overlays,
|
||||
Input::Requests,
|
||||
Input::Scroll,
|
||||
];
|
||||
|
||||
@@ -117,7 +122,7 @@ pub(crate) fn observe<T: PartialEq + Send + Sync + 'static>(ctx: &Context, input
|
||||
|
||||
/// The generation `input` has now. The inputs a pass can change while views run (keys, drag, focus, open layers) are
|
||||
/// observed here; the pointer and the modifiers by the pointer's begin hook, the window facts and the layout where
|
||||
/// the frame's root env is built, the keymap by the command board.
|
||||
/// the frame's root env is built, the keymap by the command board, the requests by each request.
|
||||
pub(crate) fn generation(ctx: &Context, input: Input) -> u64 {
|
||||
match input {
|
||||
Input::Keys => observe(ctx, input, crate::runtime::keys::keys_state(ctx)),
|
||||
@@ -125,7 +130,7 @@ pub(crate) fn generation(ctx: &Context, input: Input) -> u64 {
|
||||
Input::Focus => observe(ctx, input, crate::runtime::focus::focus_state(ctx)),
|
||||
Input::Overlays => observe(ctx, input, crate::runtime::overlay::open_state(ctx)),
|
||||
Input::Keymap => return crate::runtime::commands::keymap_built(ctx),
|
||||
Input::Modifiers | Input::Pointer | Input::Shell | Input::Keyboard | Input::Scroll => {}
|
||||
Input::Modifiers | Input::Pointer | Input::Shell | Input::Keyboard | Input::Requests | Input::Scroll => {}
|
||||
}
|
||||
with(ctx, |generations| generations.gens[input as usize])
|
||||
}
|
||||
|
||||
@@ -217,6 +217,9 @@ pub struct PresetBrowser<'a, K: Clone + Eq + Hash + Send + Sync + MemoProps + 's
|
||||
drop_zone: Option<DropZone>,
|
||||
extra_items: Vec<Entry<String>>,
|
||||
actions: Vec<Label>,
|
||||
/// The search field is its scope's default stop (`Initial::Default`): a picker's popover opens with the focus in
|
||||
/// it, so typing filters the presets.
|
||||
search_first: bool,
|
||||
/// A footer under the presets, made from these options with the browser's zoom bound to its slider and the count
|
||||
/// of presets.
|
||||
#[prop]
|
||||
@@ -261,6 +264,7 @@ impl<'a, K: Clone + Eq + Hash + Send + Sync + MemoProps + 'static> PresetBrowser
|
||||
drop_zone: None,
|
||||
extra_items: Vec::new(),
|
||||
actions: Vec::new(),
|
||||
search_first: false,
|
||||
footer: None,
|
||||
max_rows: None,
|
||||
room_height: None,
|
||||
@@ -269,6 +273,12 @@ impl<'a, K: Clone + Eq + Hash + Send + Sync + MemoProps + 'static> PresetBrowser
|
||||
}
|
||||
}
|
||||
|
||||
/// Makes the search field, when shown, its scope's default stop.
|
||||
pub(super) fn search_first(mut self) -> Self {
|
||||
self.search_first = true;
|
||||
self
|
||||
}
|
||||
|
||||
/// Rows after the presets, below a divider, as a preset menu lists its commands ("Create preset", "Detach"). They
|
||||
/// are rows of the browser's collection in both views: the lead reaches them with Down from the last preset, and a
|
||||
/// click or Enter on one reports `PresetEvent::Action` with its index in `labels`.
|
||||
@@ -536,6 +546,7 @@ impl<K: Clone + Eq + Hash + Send + Sync + MemoProps + 'static> PresetBrowser<'_,
|
||||
drop_zone,
|
||||
extra_items,
|
||||
actions,
|
||||
search_first,
|
||||
footer,
|
||||
max_rows,
|
||||
room_height,
|
||||
@@ -581,6 +592,7 @@ impl<K: Clone + Eq + Hash + Send + Sync + MemoProps + 'static> PresetBrowser<'_,
|
||||
if search {
|
||||
let field = TextField::search(words.search.clone(), Bind::bound(&mut local.filter)).placeholder(words.search.clone());
|
||||
let field = field.drives(list_id);
|
||||
let field = if search_first { field.default_stop() } else { field };
|
||||
field.show(ui);
|
||||
}
|
||||
if !locked {
|
||||
|
||||
@@ -25,6 +25,7 @@ use crate::layout_components::Stack;
|
||||
use crate::pickers::{FaceKind, SelectFace};
|
||||
use crate::popover::Popover;
|
||||
use crate::runtime::env::{Env, EnvView, Label};
|
||||
use crate::runtime::focus::Initial;
|
||||
use crate::runtime::memory::StageAccess;
|
||||
use crate::runtime::overlay::CloseReason;
|
||||
use crate::style::{ComponentStyle, FocusLook, StyleCx, SurfaceLook, UiTokens};
|
||||
@@ -131,7 +132,8 @@ impl<K: Value> Outcome for PresetPickerOutput<K> {
|
||||
/// - **State.** `state` is the browser's view settings; bind it with `Bind::bound`.
|
||||
/// - **Thumbnails.** Each row's `preview` paints its thumbnail, in the field and in the browser.
|
||||
/// - **Popover.** A `Popover` container: it hangs from the field, or from a point with [`open_at`](Self::open_at),
|
||||
/// and with [`resizable`](Self::resizable) its edge grips resize it and the size is saved.
|
||||
/// and with [`resizable`](Self::resizable) its edge grips resize it and the size is saved. It opens with the focus
|
||||
/// in the toolbar's search field, so typing filters the presets; without one, on its first stop.
|
||||
///
|
||||
/// ```ignore
|
||||
/// let out = PresetPicker::new("Contour", Bind::bound(&mut shape), &rows, Bind::bound(&mut state)).field(PickerField::ThumbnailAndName).show(ui);
|
||||
@@ -389,7 +391,8 @@ impl<'a, K: Value + Eq + Hash + MemoProps + 'static> PresetPicker<'a, K> {
|
||||
.row_menu(row_menu)
|
||||
.thumb_range(thumb_range)
|
||||
.columns(columns)
|
||||
.actions(action_labels.clone());
|
||||
.actions(action_labels.clone())
|
||||
.search_first();
|
||||
if let Some(options) = footer.as_ref() {
|
||||
browser = browser.footer(options.clone());
|
||||
}
|
||||
@@ -404,7 +407,7 @@ impl<'a, K: Value + Eq + Hash + MemoProps + 'static> PresetPicker<'a, K> {
|
||||
}
|
||||
browser.show(ui)
|
||||
};
|
||||
let popover = popover.collection_body();
|
||||
let popover = popover.collection_body().initial_focus(Initial::Default);
|
||||
let popover = match resizable.clone() {
|
||||
Some(key) => popover.resizable(true).remember(key),
|
||||
None => popover,
|
||||
|
||||
@@ -142,8 +142,8 @@ fn list_runs(fixture: &Fixture, props: &str) -> (usize, u32) {
|
||||
(views, rows)
|
||||
}
|
||||
|
||||
/// While nothing changes an open picker's list replays: no list row runs. The popover's first stop, the search field,
|
||||
/// takes the focus on open, as in the Brush Preset picker: a list that holds the focus runs in every pass.
|
||||
/// While nothing changes an open picker's list replays: no list row runs. The search field takes the focus on open, as
|
||||
/// in the Brush Preset picker: a list that holds the focus runs in every pass.
|
||||
#[trial]
|
||||
fn an_open_picker_with_nothing_changing_runs_no_list_row() {
|
||||
let mut value = Some(CORAL);
|
||||
|
||||
@@ -4,9 +4,12 @@
|
||||
use crate::values::kit::Scrub;
|
||||
use craft_ui::buttons::Button;
|
||||
use craft_ui::choice::Checkbox;
|
||||
use craft_ui::contract::{Bind, MemoProps, MemoView, Props as _, Show as _, ShowContainer as _, Tracked};
|
||||
use craft_ui::contract::{
|
||||
Bind, CollectionEvent, MemoProps, MemoView, Props as _, Show as _, ShowCollection as _, ShowContainer as _, Tracked, request_rename,
|
||||
};
|
||||
use craft_ui::display::Text;
|
||||
use craft_ui::layout_components::{Row, Stack};
|
||||
use craft_ui::list::{List, ListRow};
|
||||
use craft_ui::popover::Popover;
|
||||
use craft_ui::runtime::env::{BodyMode, RevealEdge, ShellCx, WindowKey};
|
||||
use craft_ui::runtime::memory::{SaveKey, set_saved_value};
|
||||
@@ -1186,6 +1189,84 @@ fn a_view_in_an_open_popover_replays_while_nothing_changes() {
|
||||
assert_eq!(scene.frame(&mut frames, vec![moved(over)]), ["Title"], "the pointer over the view runs it");
|
||||
}
|
||||
|
||||
/// The id of the list in [`rows`], which a rename request names.
|
||||
fn rows_id() -> Id {
|
||||
Id::NULL.with("memo_rows")
|
||||
}
|
||||
|
||||
#[derive(MemoProps)]
|
||||
struct Rows {}
|
||||
|
||||
/// A renamable list of three rows; returns how many renames it began.
|
||||
fn rows(_: &mut Rows, ui: &mut Ui) -> usize {
|
||||
let keys = [0_usize, 1, 2];
|
||||
let source = craft_behavior::keyed(&keys, |key: &usize| *key).with_text(|key| std::borrow::Cow::Owned(format!("Row {key}")));
|
||||
let out = List::new("Rows").id(rows_id()).rename(true).show_items(ui, &source, &mut |key, _| ListRow::new(format!("Row {key}")));
|
||||
out.events.iter().filter(|event| matches!(event, CollectionEvent::Rename(craft_behavior::EditEvent::Begin { .. }))).count()
|
||||
}
|
||||
|
||||
/// A rename request from outside runs the view whose list takes it, once; without a request the view replays.
|
||||
#[trial]
|
||||
fn a_rename_request_runs_the_view_that_takes_it_once() {
|
||||
let mut began = 0;
|
||||
let mut frame = |frames: &mut Frames| {
|
||||
frames.frame(vec![], |ui| began = MemoView::new("rows", Rows {}, rows).show(ui).unwrap_or(0));
|
||||
let ran = last_frame_memo_runs(&frames.ctx).into_iter().filter(|(_, _, run)| *run == MemoRun::Ran);
|
||||
ran.map(|(name, _, _)| short_name(name)).collect::<Vec<_>>()
|
||||
};
|
||||
let mut frames = Frames::new();
|
||||
for _ in 0..SETTLE {
|
||||
frame(&mut frames);
|
||||
}
|
||||
assert!(frame(&mut frames).is_empty(), "with no request the view replays");
|
||||
request_rename(&frames.ctx, rows_id(), &7_usize);
|
||||
assert_eq!(frame(&mut frames), ["Rows"], "a request runs the view that takes it");
|
||||
assert!(frame(&mut frames).is_empty(), "a taken request runs it no more");
|
||||
request_rename(&frames.ctx, rows_id(), &1_usize);
|
||||
frame(&mut frames);
|
||||
drop(frame);
|
||||
assert_eq!(began, 1, "the taken request opens the rename field");
|
||||
}
|
||||
|
||||
#[derive(MemoProps)]
|
||||
struct Filling {}
|
||||
|
||||
/// A button over a rule that fills its width.
|
||||
fn filling(_: &mut Filling, ui: &mut Ui) {
|
||||
Button::new("Inside").show(ui);
|
||||
craft_ui::display::Divider::horizontal().show(ui);
|
||||
}
|
||||
|
||||
/// The width of an open popover at a point holding a stack with a button, under a header with a button over a rule
|
||||
/// that fills its width, the header's content shown plainly or in a memoized view.
|
||||
fn popover_width(memo: bool) -> f32 {
|
||||
let mut fixture = craft_ui::testing::Fixture::new(move |ui| {
|
||||
Popover::new("Filling", Bind::given(true)).at_point(Pos2::new(40.0, 40.0)).collection_body().show(ui, |ui, _| {
|
||||
Stack::new()
|
||||
.fill()
|
||||
.header(|ui, _| {
|
||||
if memo {
|
||||
let _ = MemoView::new("filling", Filling {}, filling).show(ui);
|
||||
} else {
|
||||
filling(&mut Filling {}, ui);
|
||||
}
|
||||
})
|
||||
.show(ui, |ui, _| Button::new("Search").show(ui));
|
||||
});
|
||||
});
|
||||
fixture.room(Vec2::new(600.0, 400.0));
|
||||
fixture.settle();
|
||||
fixture.by_role(craft_ui::contract::Role::DIALOG).first().map(|target| target.rect.width()).expect("the popover shows")
|
||||
}
|
||||
|
||||
/// A popover sizes from its content: a rule that fills its width, in the header of a stack held in the popover's
|
||||
/// content-sized column, makes it as wide inside a memoized view as shown plainly, never as wide as the open room.
|
||||
#[trial]
|
||||
fn a_view_in_a_popover_fills_its_width_as_without_the_view() {
|
||||
let (plain, memo) = (popover_width(false), popover_width(true));
|
||||
assert!(plain > 0.0 && (memo - plain).abs() <= 0.5, "the popover is as wide with the view: {memo} against {plain}");
|
||||
}
|
||||
|
||||
#[derive(MemoProps)]
|
||||
struct Centred {
|
||||
label: String,
|
||||
|
||||
Reference in New Issue
Block a user