Skip to main content

CollapsiblePanelState

Struct CollapsiblePanelState 

Source
pub struct CollapsiblePanelState {
    pub side: DockSide,
    pub open: bool,
    pub open_t: f32,
    pub size_px: f32,
    pub min_size_px: f32,
    pub max_size_px: f32,
    pub separator_px: f32,
    /* private fields */
}
Expand description

State for a single side-docked, collapsible panel.

Wrapped in Rc<RefCell<_>> and remembered by the caller; the slide animation is advanced inside CollapsibleSidePanel each frame.

Fields§

§side: DockSide§open: bool

Logical open/closed flag (drives the animation target).

§open_t: f32

Animated openness, 0..1 (1 = fully open). Follows the pointer while an edge drag is in progress.

§size_px: f32

Width (Left/Right) or height (Top/Bottom) of the open panel body, in dp.

§min_size_px: f32§max_size_px: f32§separator_px: f32

Thickness of the draggable separator edge, in dp.

Implementations§

Source§

impl CollapsiblePanelState

Source

pub fn new(side: DockSide, size_px: f32) -> Self

Source

pub fn toggle(&mut self)

Source

pub fn visible_body_size(&self) -> f32

Visible body size (excluding the separator), honoring an active drag.

Source

pub fn visible_total(&self) -> f32

Total extent of the panel slot, including the separator hit strip.

Source

pub fn advance(&mut self) -> bool

Advance the slide animation toward the logical open target. Returns true if still animating (caller should request_frame).

Source

pub fn begin_edge_drag(&mut self, pointer_along_axis: f32)

Source

pub fn edge_drag(&mut self, pointer_along_axis: f32)

Update the drag from the current pointer position along the panel axis.

Source

pub fn end_edge_drag(&mut self)

End the drag: snap open/closed. A partially-open pull snaps to the nearest state and animates there on subsequent frames.

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> ErasedDestructor for T
where T: 'static,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.