Skip to main content

ZoneRegistry

Struct ZoneRegistry 

Source
pub struct ZoneRegistry<T: Clone + 'static> { /* private fields */ }
Expand description

Registry of the currently registered drop zones, in registration order.

Implementations§

Source§

impl<T: Clone + 'static> ZoneRegistry<T>

Source

pub fn from_signal(zones: Signal<Vec<ZoneRecord<T>>>) -> Self

Wrap an existing signal. Prefer crate::core::hooks::use_dnd_provider.

Source

pub fn release_policy(&self) -> ReleasePolicy<T>

Current collision and release policy.

Source

pub fn set_release_policy(&mut self, policy: ReleasePolicy<T>)

Synchronize the provider’s collision and release policy.

Source

pub fn direction(&self) -> Direction

Layout direction spatial ordering follows.

Source

pub fn set_direction(&mut self, dir: Direction)

Set the layout direction (no-op if unchanged; safe to call every render). DndProvider’s dir prop calls this for you.

Source

pub fn register(&mut self, record: ZoneRecord<T>) -> ZoneRegistration

Add (or replace, by id) a zone.

Source

pub fn sync_label(&mut self, id: ZoneId, label: Option<String>)

Update a zone’s label in place (no-op if unchanged or unknown).

Source

pub fn unregister(&mut self, id: ZoneId)

Remove a zone (call when its component unmounts).

Source

pub fn unregister_registration(&mut self, registration: ZoneRegistration)

Remove this exact registration if it is still current.

A keyed Dioxus replacement may mount a new record with the same id before the old component’s cleanup runs. Token-aware cleanup prevents that stale cleanup from deleting the replacement.

Source

pub fn set_mounted( &mut self, registration: ZoneRegistration, mounted: Rc<MountedData>, )

Attach the mounted element to this exact registration. A stale registration token is ignored.

Source

pub fn set_rect_if_present( &mut self, registration: ZoneRegistration, rect: Rect, )

Store a rect only while the registration that requested it is still current. This never inserts a missing zone and therefore cannot resurrect one that unmounted during an async measurement.

Source

pub fn set_rect(&mut self, id: ZoneId, rect: Rect)

Set geometry for the current registration of id. This is the synchronous/manual counterpart to Self::set_rect_if_present, used by custom layout adapters and the headless test driver.

Source

pub fn get(&self, id: ZoneId) -> Option<ZoneRecord<T>>

Look up a zone by id.

Source

pub fn cached_rect(&self, id: ZoneId) -> Option<Rect>

The zone’s cached client rect, read without subscribing. Returns None when unmeasured, unknown, or the provider is already gone.

Source

pub fn mounted_handle(&self, id: ZoneId) -> Option<Rc<MountedData>>

The zone’s mounted element, read without subscribing. Returns None before mount, for an unknown zone, or after provider teardown.

Source

pub fn records(&self) -> Vec<ZoneRecord<T>>

Every registered zone, in registration order. Unlike the peeking lookups around it this is a subscribing read - a component rendering from it re-renders when zones mount or unmount - because its consumers (the debug overlay, your own devtools) are renderers.

Source

pub fn contains(&self, id: ZoneId) -> bool

Is a zone with this id registered here? The parent-zone context is shared across payload types, so a record’s parent can name a zone living in another type’s registry - check before navigating to one.

Source

pub fn ascend(&self, current: ZoneId) -> Option<ZoneId>

The zone keyboard navigation should enter when ascending from current: its parent, but only when that parent is registered in this registry. A DropZone<A> nested inside a DropZone<B> records B’s id as its parent, and entering an id this registry can’t resolve would leave the drag hovering a zone that can never receive it.

Source

pub fn acceptable(&self, payload: &T) -> Vec<ZoneRecord<T>>

All zones accepting payload, in registration order.

Source

pub fn acceptable_query(&self, query: &DropQuery<T>) -> Vec<ZoneRecord<T>>

All zones accepting a complete drop query.

Source

pub fn step_zone( &self, current: Option<ZoneId>, payload: &T, step: isize, ) -> Option<ZoneId>

The next/previous zone (cyclic) relative to current among zones that accept payload. step is +1 or -1.

Order is spatial (top-to-bottom, then left-to-right) for zones with measured rects; tops within one CSS pixel form a row so sub-pixel layout jitter cannot override horizontal reading order. Call Self::refresh_rects first, as the built-in keyboard interaction does on pickup. Unmeasured zones keep registration order afterwards.

Source

pub fn step_zone_query( &self, current: Option<ZoneId>, query: &DropQuery<T>, step: isize, ) -> Option<ZoneId>

Source

pub fn parent_of(&self, id: ZoneId) -> Option<ZoneId>

The parent of a zone, if it’s nested.

Source

pub fn children_of( &self, parent: Option<ZoneId>, payload: &T, ) -> Vec<ZoneRecord<T>>

Zones directly inside parent (None = root level) that accept payload, in spatial order (top-to-bottom, then left-to-right within a one-CSS-pixel row band; unmeasured zones keep registration order at the end).

Source

pub fn children_of_query( &self, parent: Option<ZoneId>, query: &DropQuery<T>, ) -> Vec<ZoneRecord<T>>

Source

pub fn step_sibling( &self, current: Option<ZoneId>, payload: &T, step: isize, ) -> Option<ZoneId>

Next/previous zone (cyclic) among the siblings of current - zones sharing its parent. With no current, cycles the root level.

Source

pub fn step_sibling_query( &self, current: Option<ZoneId>, query: &DropQuery<T>, step: isize, ) -> Option<ZoneId>

Source

pub fn first_child(&self, id: ZoneId, payload: &T) -> Option<ZoneId>

The first (spatially) acceptable zone nested inside id.

Source

pub fn first_child_query( &self, id: ZoneId, query: &DropQuery<T>, ) -> Option<ZoneId>

Source

pub fn hit_test(&self, point: Point) -> Option<ZoneId>

Last record in registry order containing point (client coordinates), using cached rects - call Self::refresh_rects when a drag starts. This only approximates DOM paint order; CSS stacking and portals are not inspected. Replacing a same-id record retains its existing slot.

Source

pub fn hit_test_closest( &self, point: Point, payload: &T, max_distance: f64, ) -> Option<ZoneId>

Like Self::hit_test, but acceptance-aware: it returns the last record in registry order that both contains the point and accepts payload, and when no such zone contains the point, falls back to the acceptable zone whose rect is nearest - within max_distance CSS px of its closest edge, not its center, so a large zone snaps a release right beside it even though its center sits far away. Skipping zones that reject the payload lets a drop land on an earlier accepting overlap, and is friendlier for imprecise (touch) drops that land in the gutter between zones.

Source

pub fn resolve( &self, query: &DropQuery<T>, point: Point, active_rect: Option<Rect>, max_distance: f64, ) -> Option<(ZoneId, DropEffect)>

Resolve a target with this registry’s collision policy and return the target-negotiated effect. Candidates are filtered by the full query before collision ranking, so hover and release share acceptance.

Source

pub fn resolve_hover( &self, query: &DropQuery<T>, point: Point, active_rect: Option<Rect>, current: Option<ZoneId>, ) -> Option<(ZoneId, DropEffect)>

Resolve live hover with optional sticky retention. Exact collisions always win. On an exact miss, a sticky policy may retain only the current acceptable target while the pointer remains inside its recovery radius.

Source

pub async fn measure_all(&self)

Re-measure every mounted zone’s client rect and wait for the measurements to land - unlike Self::refresh_rects, which fires and forgets. Use before a hit-test that must see fresh geometry (e.g. retrying a missed touch drop after a layout change).

Source

pub fn refresh_rects(&self)

Re-measure every mounted zone’s client rect (async, spawned).

Trait Implementations§

Source§

impl<T: Clone + 'static> Clone for ZoneRegistry<T>

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<T: Clone + 'static> Copy for ZoneRegistry<T>

Source§

impl<T: Clone + 'static> PartialEq for ZoneRegistry<T>

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

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DependencyElement for T
where T: 'static + PartialEq + Clone,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> InitializeFromFunction<T> for T

Source§

fn initialize_from_function(f: fn() -> T) -> T

Create an instance of this type from an initialization function
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<Ret> SpawnIfAsync<(), Ret> for Ret

Source§

fn spawn(self) -> Ret

Spawn the value into the dioxus runtime if it is an async block
Source§

impl<T, O> SuperFrom<T> for O
where O: From<T>,

Source§

fn super_from(input: T) -> O

Convert from a type to another type.
Source§

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

Source§

fn super_into(self) -> O

Convert from a type to another type.
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, <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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more