Skip to main content

ModifierNodeSlices

Struct ModifierNodeSlices 

Source
pub struct ModifierNodeSlices { /* private fields */ }
Expand description

Snapshot of modifier node slices that impact draw and pointer subsystems.

Implementations§

Source§

impl ModifierNodeSlices

Source

pub fn draw_commands(&self) -> &[DrawCommand]

Returns the node’s draw commands in the order they draw.

Source

pub fn outer_draw_command_count(&self) -> usize

How many leading draw_commands come from modifiers chained before the node’s graphics layer or clip. Those draw around the layer in the parent’s space, outside its clip, alpha and transform, exactly as an outer drawBehind wraps a graphicsLayer.

Source

pub fn pointer_inputs(&self) -> &[Rc<dyn Fn(PointerEvent)>]

Returns the node’s pointer input handlers in chain order.

Source

pub fn dispatch_pointer_event(&self, event: PointerEvent)

Dispatches an event whose position is already local to this layout node. Consumed events stop propagation except for release and cancellation, which reach every handler so each can finish its active interaction.

Source

pub fn pointer_input_size_sinks(&self) -> &[Rc<Cell<Size>>]

The write targets for this node’s resolved size, one per pointer-input node that exposes a size to its handler. See ModifierNodeSlices::publish_pointer_input_size.

Source

pub fn publish_pointer_input_size(&self, size: Size)

Publishes this layout node’s resolved size to every pointer-input handler attached to it, so PointerInputScope::size() reports the node’s real dimensions.

Called by every pass that resolves a node’s geometry (the layout place passes and the per-frame scene build), so the size is current before any pointer event for that frame is dispatched and tracks resizes.

size is the node’s layout box — the same box the dispatched PointerEvent positions are made local to — so handlers can compare event coordinates against it directly.

Source

pub fn z_index(&self) -> f32

Where the node draws among its siblings: the sum of its z_index modifiers.

Source

pub fn pointer_icon(&self) -> Option<&PointerIcon>

The pointer’s appearance over this node, when a pointer_icon modifier names one. The innermost declaration in the chain wins.

Source

pub fn clip_to_bounds(&self) -> bool

Returns whether the node clips its content to its bounds.

Source

pub fn layer_bounds(&self, node_size: Size) -> Rect

The bounds of the node’s layer in a node of node_size, where its clip cuts and its transforms pivot: as in Compose, the rect of the coordinator its outermost clip or graphics layer wraps, so an offset declared after it moves the content inside the layer rather than the layer. The node’s own rect when it has neither.

Source

pub fn motion_context_animated(&self) -> bool

Returns whether a scroll container on this node is moving its content, for example in a fling or a settle.

Source

pub fn translated_content_context(&self) -> bool

Returns whether this node is a scroll container that draws its content translated by Self::translated_content_offset.

Source

pub fn translated_content_context_identity(&self) -> Option<usize>

Returns an identifier of that scroll container that stays the same while it lives, or None when the node is not one.

Source

pub fn translated_content_offset(&self) -> Option<Point>

Returns the offset in logical pixels by which the scroll container translates its content now, or None when the node has no such offset.

Source

pub fn has_text(&self) -> bool

Whether the node shows a Text’s or a text field’s text.

Source

pub fn text_content(&self) -> Option<SliceTextRef<'_, str>>

Returns the plain text the node shows, or None when the node shows no text.

Source

pub fn annotated_text(&self) -> Option<SliceTextRef<'_, Rc<AnnotatedString>>>

Returns the text the node shows with its span styles, or None when the node shows no text.

Source

pub fn text_content_rect(&self, node_size: Size) -> Rect

Where the text draws in a node of node_size: the rect its layout put the text in, after every layout modifier before it.

Source

pub fn text_style(&self) -> Option<SliceTextRef<'_, TextStyle>>

Returns the style of the text the node shows, or None when the node shows no text.

Source

pub fn text_layout_options(&self) -> Option<TextLayoutOptions>

Returns the layout options of the text the node shows, or None when the node shows no text. A text field reports the default options.

Source

pub fn text_pan_resolver(&self) -> Option<TextPanResolver>

Returns the horizontal pan resolver for single-line text fields.

The resolver takes the content viewport width (px) and returns the horizontal scroll offset that keeps the cursor visible. Renderers subtract this offset from the text origin so the glyphs pan together with the cursor and selection.

Source

pub fn text_window(&self) -> Option<&Rc<Cell<WindowCoordinates>>>

The write target for a text node’s size and local-to-window transform, used by editable and selectable text for caret, selection and pointer geometry and a focused field’s window bounds.

Source

pub fn viewport_window_rect(&self) -> Option<&Rc<dyn WindowRectSink>>

The write target for a scroll container’s composited window rect, if this node carries a report_window_rect modifier. The layout pass writes the node’s true on-screen viewport rect here so a BringIntoViewResponder can scroll a focused field’s caret above the soft keyboard.

Source

pub fn measured_text_layout(&self) -> Option<Rc<PreparedTextLayout>>

Returns the text layout this node’s Text or text field produced when layout last measured it, laid out at the same width.

A text field’s layout is its current text wrapped at the width its caret and selection are placed on. None when the node carries no text, or carries a Text that has not been measured yet.

Source

pub fn graphics_layer(&self) -> Option<GraphicsLayer>

Returns the graphics layer that the layer modifiers of the chain combine into, or None when the chain has none.

Source

pub fn corner_shape(&self) -> Option<RoundedCornerShape>

Returns the rounded corner shape the chain sets, or None when it sets none.

Source

pub fn with_chain_guard(self, handle: ModifierChainHandle) -> Self

Returns these slices holding handle, which keeps the node chain they come from alive.

Source

pub fn debug_stats(&self) -> ModifierNodeSlicesDebugStats

Returns counts and capacities of the slices’ data, for memory diagnostics.

Source

pub fn clear(&mut self)

Resets the slice collection for reuse, retaining vector capacity.

Trait Implementations§

Source§

impl Clone for ModifierNodeSlices

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 ModifierNodeSlices

Source§

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

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

impl Default for ModifierNodeSlices

Source§

fn default() -> Self

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.