pub struct FloatingCard {
pub id: String,
pub title: String,
pub icon: Option<String>,
pub at: Option<[f32; 3]>,
pub screen: Option<[f32; 2]>,
pub widgets: Vec<Widget>,
pub focus: Option<String>,
pub ok: String,
pub refusal: Option<String>,
pub hint: Option<String>,
pub ok_only: bool,
}Expand description
A card over the view, next to what it edits: a quick edit of a value
or two (a dimension, a corner’s size). Anything with more to it is a
task in the right panel. The host draws widgets as it draws a task
panel’s, with OK and Cancel under them; Enter is OK and Escape Cancel.
OK and Cancel reach the bench as PanelEvent::CardClose. Edits wait
in the bench until OK: the host makes what OK writes one undo step,
and takes back anything written while the card was open on Cancel.
A click in the view elsewhere is OK, while OK is allowed.
With a hint the card is a readout instead: the values a tool is
drawing with, typed through the bench’s own keys. The host draws the
hint in place of OK and Cancel, leaves the keys and the pointer with
the bench, holds no undo step and sends no CardClose. One card shows
at a time.
Fields§
§id: StringNames the card: one with a new id opens afresh, the field named by
focus taking the keys again.
title: String§icon: Option<String>§at: Option<[f32; 3]>The point it is beside, in world space.
screen: Option<[f32; 2]>The point it is beside in viewport pixels, when it has no at;
left out of both, the view’s middle.
widgets: Vec<Widget>§focus: Option<String>The id of the text or number field that has the keys as the card opens, its text selected so the first key typed replaces it.
ok: StringOK’s words; OK when empty.
refusal: Option<String>Why OK is held back: written under the widgets, OK disabled and Enter and a click elsewhere doing nothing.
hint: Option<String>The line under the widgets of a readout card, in place of OK and
Cancel: what the keys do (Tab next · Enter places it).
ok_only: boolOK alone, no Cancel: Escape is OK too, and only a refused card is dropped. For what a step already made leaves to set.