Skip to main content

Resizable

Trait Resizable 

Source
pub trait Resizable<C: DragConfig = Config>: Selectable<C> {
    // Required method
    fn resize_targets(
        &self,
        handle: ResizeHandle,
    ) -> (Option<C::Element>, Option<C::Element>);

    // Provided methods
    fn resize_handles(
        &self,
        cfg: &C,
        measure: &dyn MeasureText,
    ) -> Option<[(ResizeHandle, RectF); 8]> { ... }
    fn hit_resize_handle(
        &self,
        cfg: &C,
        measure: &dyn MeasureText,
        x: f32,
        y: f32,
    ) -> Option<ResizeHandle> { ... }
    fn resize_by(
        &self,
        cfg: &mut C,
        handle: ResizeHandle,
        dx: f32,
        dy: f32,
    ) -> NudgeResult { ... }
}
Expand description

A selectable element whose extent can be adjusted by dragging the eight handles on its selection box.

Required Methods§

Source

fn resize_targets( &self, handle: ResizeHandle, ) -> (Option<C::Element>, Option<C::Element>)

The nudge elements a handle’s (horizontal, vertical) motion drives — the only thing an implementation defines. None components are discarded (an edge-midpoint handle resizes along one dimension).

Provided Methods§

Source

fn resize_handles( &self, cfg: &C, measure: &dyn MeasureText, ) -> Option<[(ResizeHandle, RectF); 8]>

Default handle geometry: eight squares on the selection box (element bounds + SELECTION_PADDING).

Source

fn hit_resize_handle( &self, cfg: &C, measure: &dyn MeasureText, x: f32, y: f32, ) -> Option<ResizeHandle>

Default handle hit test.

Source

fn resize_by( &self, cfg: &mut C, handle: ResizeHandle, dx: f32, dy: f32, ) -> NudgeResult

Default resize pipeline: each motion component routes through Config::nudge on its target element, so resize obeys exactly the same feasibility rules as dragging those elements directly.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§