bevy_mod_picking icon indicating copy to clipboard operation
bevy_mod_picking copied to clipboard

`PointerDrag` component

Open musjj opened this issue 2 years ago • 1 comments

A PointerDrag component would be convenient for checking if a certain pointer is dragging something when you're dealing with complex logic.

Maybe it can look something like this:

#[derive(Component, Deref)]
struct PointerDrag(Option<Entity>);

It will contain Some(Entity) when the pointer is currently dragging an entity.

musjj avatar Dec 09 '23 09:12 musjj

This already exists in the form of events and event listeners. You could create your own special purpose component for this purpose if you want some other behavior.

https://docs.rs/bevy_mod_picking/latest/bevy_mod_picking/events/struct.Drag.html https://github.com/aevyrie/bevy_mod_picking/blob/main/examples/drag_and_drop.rs

I'm not sure if we want to add components for every type of event. This would also need to be a Vec, as a pointer can be dragging multiple entities at a time.

aevyrie avatar Mar 03 '24 09:03 aevyrie