Skip to main content

Module dnd

Module dnd 

Source
Expand description

Script-facing drag-and-drop event dispatchers (on_drop / on_drag_start). See the module docs. Script-facing drag-and-drop events.

Surfaces the in-app DnD pipeline (lumen-os-dnd) to app scripts the same way pointer events reach them - one uniform host seam, not a Rhai-only builtin, so every binding / SDK gets it (like page() / http()):

  • [DropAccepted] -> on_drop(target_id, payload) with per-id routing via on("drop", "<target_id>", "<fn>").
  • [DragStarted] -> on_drag_start(source_id, payload) with per-id routing via on("drag_start", "<source_id>", "<fn>").

payload is the source’s text payload (its drag-payload attr, or its id when the payload was derived from the element id).

Mirrors HTML5 ondrop(event) - event.target is the drop zone, event.dataTransfer.getData() is the payload - and Qt’s dropEvent carrying the source + QMimeData. Kept in its own submodule so the shared lib.rs touch stays to two add_systems lines.

Functions§

dispatch_drag_start_to_script
Forward each DragStarted to the script as on_drag_start(source_id, payload).
dispatch_drops_to_script
Forward each DropAccepted to the script as on_drop(target_id, payload). A reactive on_drop that reassigns a signal drives the next reconcile - no per-frame polling.