Add true multitouch trackpad support.
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## What problem does this solve or what need does it fill?
At present, trackpad events are captured as if the trackpad were a mouse. For example, on a MacBook Pro, events come in as a left mouse press / release event. The MacBook Pro trackpad is actually a multitouch display, however. Bevy should emit touches as if it were any other multitouch display, along with press / release events.
## What solution would you like?
After talking to @alice-i-cecile, it seems the solution is to have Bevy emit touches (as if it were a multitouch display) _and_ emit the mouse behavior if someone wants to opt into that default behavior. An example of what I'd like to accomplish using the trackpad is:
* Pan the camera by dragging two fingers on the trackpad.
* Zoom in and out by detecting pinch to zoom gestures.
* Other multitouch gestures as things come up.
One potential issue is that the MacBook Pro trackpad touch events should support press / release states when your finger touches and releases from the screen, _and also trackpad click events as the trackpad itself can be fully depressed_. Both types of touches should be supported which might be an issue with the current `Touches` implementation:
```rust
pub struct Touches {
/// A collection of every [`Touch`] that is currently being pressed.
pressed: HashMap,
/// A collection of every [`Touch`] that just got pressed.
just_pressed: HashMap,
/// A collection of every [`Touch`] that just got released.
just_released: HashMap,
/// A collection of every [`Touch`] that just got cancelled.
just_cancelled: HashMap,
}
```
It may be that Bevy should have a `Trackpad` input abstraction for this case that supports both touch events _and_ button-click events in one interface but I'm not sure. There may even be trackpads that support multitouch but also have separate physical buttons.
## What alternative(s) have you considered?
For now, I'm getting around this by using keyboard shortcuts to zoom the world and holding a modifier key while dragging my finger on the trackpad for drag events which is not ideal.
Contributor guide
Assessment
This issue has not been assessed yet.