flame-engine / flame-engine/flame

Continue to receive drag (and eventually hover) events after the pointer has left the component

Open
#2,719 0 comments 0 reactions 1 assignee Claimed by @luanpotter View on GitHub
enhancement
Dominant language
Dart
Stars
10.8k
Forks
1k
Avg merge
1d 20h
Merged PRs (30d)
21

Description

# What could be improved

Currently only event updates that happen still within the component bounds are propagated. Even if a drag (or hover) started within the component, once the pointer leaves, it stops receiving updates.

We should provide an option for the user to configure this; for example:

```
class FooComponent extends PositionComponent with DragCallbacks {
// false by default; or some other name like this
@override
bool get continueReceivingDragCallbacks => true;
}
```

Same for the hovers.

This should actually be true by default as this use case is much more common.

# Why should this be improved

Similar rationale of https://github.com/flame-engine/flame/issues/2718

Also if you are dragging a component around too fast, it "loses track" (i.e. if your mouse displacement is bigger than the component's size).

# Any risks?

No.

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.