bevyengine / bevyengine/bevy

Picking: Unintuitive `Pointer<Click>` event generated after drag

Open
#19,833 6 comments 2 reactions 0 assignees View on GitHub
A-Picking A-UI C-Bug S-Needs-Investigation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version

0.16.1

## What you did

- Press left click over a mesh with a `Pointer` observer but no `Pointer` observer
- Drag the pointer (to move the camera in my app), moving the pointer off the mesh
- Coincidentally release left click over the same mesh it started on

## What went wrong

A `Pointer` event is observed. In my opinion this behaviour is very unintuitive, since the pointer moved off the mesh while the drag was occurring. I did not intend to click on the object and semantically I didn't, I happened to mouse down on the mesh as I started dragging the viewport and happened to mouse up on the same mesh at the end.

There is no obvious/documented way to prevent a `Click` event occurring after a drag, one possible workaround is to use the `duration` field of the `Click` event, however this is lacking since ideally a long click without any pointer movement should still be registered as a click. To implement the intuitively expected behaviour would require a significant amount of work on the part of the user, both to design the correct UX behaviour and then implement it at a low level with Press, Release, and Move tracking. I think this should really come batteries-included with bevy, even if it has to be a bit opinionated.

I'm not sure what the best solution to this would be, since a click with a tiny amount of pointer movement should also still be a click, but adding some movement threshold to start a `Pointer` might feel unresponsive for objects that observe both. If keeping the current behaviour is also important for some reason I've missed then a new pointer event could be added that correctly excludes drags.

Contributor guide

Open the contributing guide

Research direction

The issue names no files, tests, or entry points. Reproduce the Bevy 0.16.1 sequence with Pointer and Pointer, then investigate the picking pointer-event behavior and define how a drag that leaves and returns to the mesh should affect click generation; completion should include agreed semantics and regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.