Fusuma

Components / Basics

drop_target

view, which takes what is dropped on it: on_drop is what a drop sends (the app moves what it was carrying, which it remembered when the drag started).

How it looks

Drawn by the toolkit from the example below. No page of the gallery uses drop_target yet, so there is nothing to run.

drop_target drawn by Fusuma

view, which takes what is dropped on it: on_drop is what a drop sends (the app moves what it was carrying, which it remembered when the drag started). It is outlined while a drag is over it.

Signature

pub const fn drop_target<V, M>(view: V, on_drop: M) -> Dnd<V, M>

Methods

  • .on_cancel(message: M) -> Self — Sends message when a drag from this view ends without a drop.
  • .on_drop(message: M) -> Self — Also takes drops, sending message (a view that can be carried and also be dropped on).

Example

use fusuma::{drop_target, text};
let view = drop_target(text("Drop here"), ());
let built = fusuma::doc::built::<(), _>(&view);
assert_eq!(built.texts(), ["Drop here"]);

All components · Source