Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support trackpad scroll with InputEventPanGesture #40

Open
jmoon1506 opened this issue Dec 27, 2023 · 3 comments
Open

Support trackpad scroll with InputEventPanGesture #40

jmoon1506 opened this issue Dec 27, 2023 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@jmoon1506
Copy link

Enable two finger scrolling on MacBooks with InputEventPanGesture events.

@SpyrexDE SpyrexDE added the enhancement New feature or request label Dec 30, 2023
@SpyrexDE
Copy link
Owner

I just added basic support, however, this will need more work for it to feel not as spongy as it is right now:

if event is InputEventPanGesture:
if should_scroll_horizontal():
velocity.x = -event.delta.x * speed
if should_scroll_vertical():
velocity.y = -event.delta.y * speed

The current implementation ignores overdrag and relies on the scroll wheel speed variable which is not optimal.

@HaroldLever
Copy link
Contributor

HaroldLever commented Jan 2, 2024

Probably considering pan gesture as dragging would be a better way? But I don't know there is any way to know when gesture starts or ends. Another way is to calculate velocity that is needed to scroll to specific destination.

@SpyrexDE
Copy link
Owner

SpyrexDE commented Jan 2, 2024

Probably considering pan gesture as dragging would be a better way? But I don't know there is any way to know when gesture starts or ends.

I thought about that as well, however, it is exactly as you say. Reading the pan gesture is quite different to reading dragging. The pan gesture only provides a delta (how much the value changed) whereas when reading dragging we know when it starts and when it ends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants