bevyengine / bevyengine/bevy

The delta from Pointer<Drag> drifts away when dragging a Pickable

Open
#20,372 1 comment 0 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 22h
Merged PRs (30d)
161

Description

## Bevy version

0.16

## What you did

Dragged a `Pickable`.

## What went wrong

The values of `delta` from `Pointer` vs `MouseMotion` are different when a drag starts on `Pickable`.
The value via `Pointer` drifts away in the direction of the drag by a constant multiplier of `window.scale_factor()/3.0`, i.e. the drift vanishes if the `window.scale_factor` is set to `3`.

## Additional information

I have a small demo for this, the code for which can be found here: https://github.com/yatinmaan/drag-test

Notice, in the top left, that the Diff (= drag_delta - mouse_motion) stays near zero when I drag outside the `Pickable`.
But when I start the drag **on** the `Pickable` the Diff accumulates error and the Scaled Diff (= drag_delta*window.scale_factor/3 - mouse motion) stays near zero.

https://github.com/user-attachments/assets/c8e26066-d144-4dce-9357-9e1b57078d7e

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.