aevyrie / bevy_mod_picking

Picking and pointer events for Bevy.
https://crates.io/crates/bevy_mod_picking
Apache License 2.0
764 stars 170 forks source link

Single click also fires drag events #330

Closed alexparlett closed 3 months ago

alexparlett commented 3 months ago
10:50 INFO drag start
10:50 INFO drag
10:50 INFO click
10:50 INFO drag
10:50 INFO drag
10:50 INFO drag end

The above fires from a single click, with the entity having:

On::<Pointer<DragStart>>
On::<Pointer<DragEnd>>
On::<Pointer<Drag>>
On::<Pointer<Click>>

Behaviour i've noticed is that when when im not pressing and moving, just pressing down or clicking the drag events start to fire.

This can lead to conflicts between systems when they are both attempting to update the same field (i.e. click on a slider or drag the handle).

Feels like drag should only happen when the pointer is down and moved.

aevyrie commented 3 months ago

If the library waited until the movement starts, the event will be delayed. Instead, it is up to consumers to decide how long of a drag delta they want to consider as the start of the drag.