Skip to main content

FloatingCard

Struct FloatingCard 

Source
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: String

Names 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: String

OK’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: bool

OK alone, no Cancel: Escape is OK too, and only a refused card is dropped. For what a step already made leaves to set.

Trait Implementations§

Source§

impl Clone for FloatingCard

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FloatingCard

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FloatingCard

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for FloatingCard

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for FloatingCard

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for FloatingCard

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for FloatingCard

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.