Modifier

Struct Modifier 

Source
pub struct Modifier {
Show 58 fields pub key: Option<u64>, pub size: Option<Size>, pub width: Option<f32>, pub height: Option<f32>, pub fill_max: bool, pub fill_max_w: bool, pub fill_max_h: bool, pub padding: Option<f32>, pub padding_values: Option<PaddingValues>, pub min_width: Option<f32>, pub min_height: Option<f32>, pub max_width: Option<f32>, pub max_height: Option<f32>, pub background: Option<Brush>, pub border: Option<Border>, pub flex_grow: Option<f32>, pub flex_shrink: Option<f32>, pub flex_basis: Option<f32>, pub flex_wrap: Option<FlexWrap>, pub flex_dir: Option<FlexDirection>, pub align_self: Option<AlignSelf>, pub justify_content: Option<JustifyContent>, pub align_items_container: Option<AlignItems>, pub align_content: Option<AlignContent>, pub clip_rounded: Option<f32>, pub z_index: f32, pub repaint_boundary: bool, pub click: bool, pub on_scroll: Option<Rc<dyn Fn(Vec2) -> Vec2>>, pub on_pointer_down: Option<Rc<dyn Fn(PointerEvent)>>, pub on_pointer_move: Option<Rc<dyn Fn(PointerEvent)>>, pub on_pointer_up: Option<Rc<dyn Fn(PointerEvent)>>, pub on_pointer_enter: Option<Rc<dyn Fn(PointerEvent)>>, pub on_pointer_leave: Option<Rc<dyn Fn(PointerEvent)>>, pub semantics: Option<Semantics>, pub alpha: Option<f32>, pub transform: Option<Transform>, pub grid: Option<GridConfig>, pub grid_col_span: Option<u16>, pub grid_row_span: Option<u16>, pub position_type: Option<PositionType>, pub offset_left: Option<f32>, pub offset_right: Option<f32>, pub offset_top: Option<f32>, pub offset_bottom: Option<f32>, pub margin_left: Option<f32>, pub margin_right: Option<f32>, pub margin_top: Option<f32>, pub margin_bottom: Option<f32>, pub aspect_ratio: Option<f32>, pub painter: Option<Rc<dyn Fn(&mut Scene, Rect)>>, pub on_drag_start: Option<Rc<dyn Fn(DragStart) -> Option<DragPayload>>>, pub on_drag_end: Option<Rc<dyn Fn(DragEnd)>>, pub on_drag_enter: Option<Rc<dyn Fn(DragOver)>>, pub on_drag_over: Option<Rc<dyn Fn(DragOver)>>, pub on_drag_leave: Option<Rc<dyn Fn(DragOver)>>, pub on_drop: Option<Rc<dyn Fn(DropEvent) -> bool>>, pub on_action: Option<Rc<dyn Fn(Action) -> bool>>,
}

Fields§

§key: Option<u64>

Optional stable identity key for this view node.

If set, layout_and_paint will prefer this over child index when assigning stable ViewIds. This is the “escape hatch” for dynamic lists / conditional UI where index-based identity would otherwise shift.

§size: Option<Size>§width: Option<f32>§height: Option<f32>§fill_max: bool§fill_max_w: bool§fill_max_h: bool§padding: Option<f32>§padding_values: Option<PaddingValues>§min_width: Option<f32>§min_height: Option<f32>§max_width: Option<f32>§max_height: Option<f32>§background: Option<Brush>§border: Option<Border>§flex_grow: Option<f32>§flex_shrink: Option<f32>§flex_basis: Option<f32>§flex_wrap: Option<FlexWrap>§flex_dir: Option<FlexDirection>§align_self: Option<AlignSelf>§justify_content: Option<JustifyContent>§align_items_container: Option<AlignItems>§align_content: Option<AlignContent>§clip_rounded: Option<f32>§z_index: f32

Works for hit-testing only, draw order is not changed.

§repaint_boundary: bool§click: bool§on_scroll: Option<Rc<dyn Fn(Vec2) -> Vec2>>§on_pointer_down: Option<Rc<dyn Fn(PointerEvent)>>§on_pointer_move: Option<Rc<dyn Fn(PointerEvent)>>§on_pointer_up: Option<Rc<dyn Fn(PointerEvent)>>§on_pointer_enter: Option<Rc<dyn Fn(PointerEvent)>>§on_pointer_leave: Option<Rc<dyn Fn(PointerEvent)>>§semantics: Option<Semantics>§alpha: Option<f32>§transform: Option<Transform>§grid: Option<GridConfig>§grid_col_span: Option<u16>§grid_row_span: Option<u16>§position_type: Option<PositionType>§offset_left: Option<f32>§offset_right: Option<f32>§offset_top: Option<f32>§offset_bottom: Option<f32>§margin_left: Option<f32>§margin_right: Option<f32>§margin_top: Option<f32>§margin_bottom: Option<f32>§aspect_ratio: Option<f32>§painter: Option<Rc<dyn Fn(&mut Scene, Rect)>>§on_drag_start: Option<Rc<dyn Fn(DragStart) -> Option<DragPayload>>>§on_drag_end: Option<Rc<dyn Fn(DragEnd)>>§on_drag_enter: Option<Rc<dyn Fn(DragOver)>>§on_drag_over: Option<Rc<dyn Fn(DragOver)>>§on_drag_leave: Option<Rc<dyn Fn(DragOver)>>§on_drop: Option<Rc<dyn Fn(DropEvent) -> bool>>§on_action: Option<Rc<dyn Fn(Action) -> bool>>

Implementations§

Source§

impl Modifier

Source

pub fn new() -> Self

Source

pub fn key(self, key: u64) -> Self

Attaches a stable identity key to this view node. Use for dynamic lists / conditional UI where index-based identity can shift.

Source

pub fn size(self, w: f32, h: f32) -> Self

Source

pub fn width(self, w: f32) -> Self

Source

pub fn height(self, h: f32) -> Self

Source

pub fn fill_max_size(self) -> Self

Source

pub fn fill_max_width(self) -> Self

Source

pub fn fill_max_height(self) -> Self

Source

pub fn padding(self, v: f32) -> Self

Source

pub fn padding_values(self, padding: PaddingValues) -> Self

Source

pub fn min_size(self, w: f32, h: f32) -> Self

Source

pub fn max_size(self, w: f32, h: f32) -> Self

Source

pub fn min_width(self, w: f32) -> Self

Source

pub fn min_height(self, h: f32) -> Self

Source

pub fn max_width(self, w: f32) -> Self

Source

pub fn max_height(self, h: f32) -> Self

Source

pub fn background(self, color: Color) -> Self

Set a solid color background.

Source

pub fn background_brush(self, brush: Brush) -> Self

Set a brush (solid, gradient, etc.) background.

Source

pub fn border(self, width: f32, color: Color, radius: f32) -> Self

Source

pub fn flex_grow(self, v: f32) -> Self

Source

pub fn flex_shrink(self, v: f32) -> Self

Source

pub fn flex_basis(self, v: f32) -> Self

Source

pub fn flex_wrap(self, w: FlexWrap) -> Self

Source

pub fn flex_dir(self, d: FlexDirection) -> Self

Source

pub fn align_self(self, a: AlignSelf) -> Self

Source

pub fn align_self_center(self) -> Self

Source

pub fn justify_content(self, j: JustifyContent) -> Self

Source

pub fn align_items(self, a: AlignItems) -> Self

Source

pub fn align_content(self, a: AlignContent) -> Self

Source

pub fn clip_rounded(self, radius: f32) -> Self

Source

pub fn z_index(self, z: f32) -> Self

Source

pub fn clickable(self) -> Self

Source

pub fn on_scroll(self, f: impl Fn(Vec2) -> Vec2 + 'static) -> Self

Source

pub fn on_pointer_down(self, f: impl Fn(PointerEvent) + 'static) -> Self

Source

pub fn on_pointer_move(self, f: impl Fn(PointerEvent) + 'static) -> Self

Source

pub fn on_pointer_up(self, f: impl Fn(PointerEvent) + 'static) -> Self

Source

pub fn on_pointer_enter(self, f: impl Fn(PointerEvent) + 'static) -> Self

Source

pub fn on_pointer_leave(self, f: impl Fn(PointerEvent) + 'static) -> Self

Source

pub fn semantics(self, s: Semantics) -> Self

Source

pub fn alpha(self, a: f32) -> Self

Source

pub fn transform(self, t: Transform) -> Self

Source

pub fn grid(self, columns: usize, row_gap: f32, column_gap: f32) -> Self

Source

pub fn grid_span(self, col_span: u16, row_span: u16) -> Self

Source

pub fn absolute(self) -> Self

Source

pub fn offset( self, left: Option<f32>, top: Option<f32>, right: Option<f32>, bottom: Option<f32>, ) -> Self

Source

pub fn offset_left(self, v: f32) -> Self

Source

pub fn offset_right(self, v: f32) -> Self

Source

pub fn offset_top(self, v: f32) -> Self

Source

pub fn offset_bottom(self, v: f32) -> Self

Source

pub fn margin(self, v: f32) -> Self

Source

pub fn margin_horizontal(self, v: f32) -> Self

Source

pub fn margin_vertical(self, v: f32) -> Self

Source

pub fn aspect_ratio(self, ratio: f32) -> Self

Source

pub fn painter(self, f: impl Fn(&mut Scene, Rect) + 'static) -> Self

Source

pub fn scale(self, s: f32) -> Self

Source

pub fn scale2(self, sx: f32, sy: f32) -> Self

Source

pub fn translate(self, x: f32, y: f32) -> Self

Source

pub fn rotate(self, radians: f32) -> Self

Source

pub fn weight(self, w: f32) -> Self

Source

pub fn repaint_boundary(self) -> Self

Marks this view as a repaint boundary candidate.

The engine may cache its painted output.

Source

pub fn on_action(self, f: impl Fn(Action) -> bool + 'static) -> Self

Source

pub fn on_drag_start( self, f: impl Fn(DragStart) -> Option<DragPayload> + 'static, ) -> Self

Mark this node as a drag source. Return Some(payload) to start dragging.

Source

pub fn on_drag_end(self, f: impl Fn(DragEnd) + 'static) -> Self

Called when a drag ends (drop accepted or canceled/ignored).

Source

pub fn on_drag_enter(self, f: impl Fn(DragOver) + 'static) -> Self

Called when a drag first enters this target.

Source

pub fn on_drag_over(self, f: impl Fn(DragOver) + 'static) -> Self

Called on every pointer move while a drag is over this target.

Source

pub fn on_drag_leave(self, f: impl Fn(DragOver) + 'static) -> Self

Called when a drag leaves this target.

Source

pub fn on_drop(self, f: impl Fn(DropEvent) -> bool + 'static) -> Self

Called on pointer release while a drag is over this target. Return true to accept the drop.

Trait Implementations§

Source§

impl Clone for Modifier

Source§

fn clone(&self) -> Modifier

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Modifier

Source§

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

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

impl Default for Modifier

Source§

fn default() -> Modifier

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

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> 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 = 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.