Sigil

Drag ghost

The node that follows the pointer.

GUITUIRuns in the browserdrag_ghost

Preview

Drag ghost, Dragged, light themeDrag ghost, Dragged, dark theme

Usage example

fn drag_ghost_demo() -> NodeBuilder {    let drag = DragState::<String>::new();    let dropped = signal(String::from("Drop a card here"));    container()        .layout(LayoutStyle::flex_column().fill_width().gap(8.0))        .child(            NodeBuilder::from(card(text("Card A").nowrap()))                .drag_source(drag.clone(), String::from("Card A")),        )        .child(NodeBuilder::from(card(text(dropped).nowrap())).drop_target(            drag.clone(),            |_| true,            move |item| dropped.set(format!("Dropped {item}")),        ))        .child(drag_ghost(drag, |item: &String| {            card(text(item.clone()).nowrap())        }))}
fn drag_ghost_demo() -> NodeBuilder {  let drag = DragState::<String>::new();  let dropped = signal(String::from(    "Drop a card here",  ));  container()    .layout(      LayoutStyle::flex_column()        .fill_width()        .gap(8.0),    )    .child(      NodeBuilder::from(card(        text("Card A").nowrap(),      ))      .drag_source(        drag.clone(),        String::from("Card A"),      ),    )    .child(      NodeBuilder::from(card(        text(dropped).nowrap(),      ))      .drop_target(        drag.clone(),        |_| true,        move |item| {          dropped.set(format!(            "Dropped {item}"          ))        },      ),    )    .child(drag_ghost(      drag,      |item: &String| {        card(          text(item.clone()).nowrap(),        )      },    ))}

States

All 2 captured states, each drawn by the window host and by the terminal host.

  • Drag ghost, Default, light themeDrag ghost, Default, dark theme
    Default
  • Drag ghost, Dragged, light themeDrag ghost, Dragged, dark theme
    Dragged

API

NameSignaturePurpose
drag_ghostfn drag_ghost<T, N>(state: DragState<T>, render: impl Fn(&T) -> N + 'static) -> NodeBuilderThe node that follows the pointer.