Fusuma

Components / Basics

draggable

view, which can be picked up when a press on it travels: on_start is what picking it up sends (the app remembers what is being carried), and Dnd::on_cancel what ending the drag over nothing sends.

How it looks

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

draggable drawn by Fusuma

view, which can be picked up when a press on it travels: on_start is what picking it up sends (the app remembers what is being carried), and Dnd::on_cancel what ending the drag over nothing sends. A press that does not travel is still a click.

Signature

pub const fn draggable<V, M>(view: V, on_start: 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::{button, draggable};
let view = draggable(button("Card"), ());
let built = fusuma::doc::built::<(), _>(&view);
assert_eq!(built.texts(), ["Card"]);

All components · Source