egui/crates/egui_demo_lib/src
Emil Ernerfeldt abd028bad3
Add drag-and-drop APIs with payloads storage (#3887)
* Closes https://github.com/emilk/egui/issues/3882

This adds several methods to make drag-and-drop more ergonomic in egui.

In particular, egui can now keep track of _what_ is being dragged for
you (the _payload_).

Low-level:
* `egui::DragAndDrop` hold the payload during a drag

Mid-level:
* `Response::dnd_set_drag_payload` sets it for drag-sources
* `Response::dnd_hover_payload` and `Response::dnd_release_payload`
reads it for drop-targets

High-level:
* `ui.dnd_drag_source`: make a widget draggable
* `ui.dnd_drop_zone`: a container where things can be dropped

The drag-and-drop demo is now a lot simpler:


https://github.com/emilk/egui/blob/emilk/drag-and-drop/crates/egui_demo_lib/src/demo/drag_and_drop.rs

---------

Co-authored-by: Antoine Beyeler <abeyeler@ab-ware.com>
2024-01-29 11:14:18 +01:00
..
demo Add drag-and-drop APIs with payloads storage (#3887) 2024-01-29 11:14:18 +01:00
easy_mark Refactor: move text selection logic to own module (#3843) 2024-01-19 15:38:53 +01:00
color_test.rs Final polish for new image loading (#3328) 2023-09-13 16:27:08 +02:00
lib.rs Fix some clippy 1.75 lints (#3754) 2023-12-30 11:23:21 +01:00