Expand description
§egui_dnd
… is a drag & drop library for egui.
Give it a try here: https://lucasmerlin.github.io/hello_egui/#/example/color_sort_vertical
To get started, take a look at the simple example.
Demo Videos:
https://github.com/lucasmerlin/hello_egui/assets/8009393/a05fa961-ef12-479c-a3fd-f765160e048e
https://github.com/lucasmerlin/hello_egui/assets/8009393/4e3b7843-822f-4900-8e8b-d516794590b7
Modules§
- utils
- Helper functions to support the drag and drop functionality
Structs§
- Dnd
- Helper struct for ease of use.
- Drag
Drop Config - Configuration for drag detection.
- Drag
Drop Response - Response containing state of the drag & drop list and a potential update to the source list.
The update can be applied immediately or at latest when
DragDropResponse::is_drag_finished
returns true. - Drag
Update - An instruction in what order to update the source list.
The item at from should be removed from the list and inserted at to.
You can use
shift_vec
to do this for a Vec. - Handle
Handle::ui
is used to draw the drag handle- Item
Iterator - Calculates some information that is later used to detect in which index the dragged item should be placed.
ItemIterator::next
should be called for each item in the list. - Item
State - State of the current item.
Traits§
- Drag
Drop Item - Item that can be reordered using drag and drop
Functions§
- dnd
- Main entry point for the drag and drop functionality.
Loads and saves it’s state from egui memory.
Use either
Dnd::show
orDnd::show_vec
to display the drag and drop UI. You can useDnd::with_mouse_config
orDnd::with_touch_config
to configure the drag detection. Example usage: