pub fn target<T: Any + Send + Sync>(
ctx: &Context,
id: &str,
rect: Rect,
refusal: impl FnOnce(&T) -> Option<String>,
) -> Seen<T>Expand description
A drop target for a payload of type T, in the window being drawn
(ctx’s viewport), by its id (unique in its window) and its rect:
what it sees of a drag this pass. refusal says why it does not take
a payload, asked each pass while one is dragged: a target that takes
it is highlighted, wherever the pointer is.
Targets nest: under the pointer, only the most specific (the
smallest containing it) sees Seen::Over and takes the drop; the
others around it see Seen::Nothing, still highlighted as taking
the drag.
A drop is delivered to the target once: as Seen::Dropped (or
Seen::Refused) in the pass it is let go over it, or in this
window’s next pass when the release was resolved before the target
was drawn (in another window, from the screen’s coordinates).