Skip to main content

SettleSlot

Function SettleSlot 

Source
pub fn SettleSlot<T: Clone + PartialEq + 'static>(
    _: SettleSlotProps<T>,
) -> Element
Expand description

Wraps the element a drop just created so the drop-settle reads as ONE object: while the ghost glides, the wrapper holds the element’s space but keeps it invisible (no “second copy” next to the ghost), re-aims the glide at its own measured rect (the ghost lands exactly where the element is, not at the zone’s center), and reveals the element the instant the ghost unmounts.

Set active: true only on the just-landed element - typically by remembering the dropped payload’s id in your on_drop handler and comparing. Inert while nothing is settling (keyboard drops, cancelled drags, overlays without settle), so it is always safe to render.

on_drop: move |o: DropOutcome<Card>| { landed.set(Some(o.payload.id)); /* model */ },
// ...
SettleSlot::<Card> { active: landing() == Some(card.id),
    Draggable::<Card> { payload: card.clone(), CardFace { card } }
}

§Props

For details, see the props struct definition.

  • phantom : std::marker::PhantomData<T>

    Internal marker; never set this.

  • active : bool

    True on the element the current settle is delivering.

  • attributes : Vec<Attribute>
  • children : Element