Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Address feedback
  • Loading branch information
moffatman committed Nov 13, 2022
commit fccefae05758fccfa66596dc44740b51de79eafe
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
static constexpr int32_t kMousePointerDeviceId = 0;
static constexpr int32_t kPointerPanZoomDeviceId = 1;

// A trackpad touch following inertial scrolling should cause an inertia cancel
// event to be issued. Use a window of 50 milliseconds after the scroll to account
// for delays in event propagation observed in macOS Ventura.
static constexpr double kTrackpadTouchInertiaCancelWindowMs = 0.050;

/**
* State tracking for mouse events, to adapt between the events coming from the system and the
* events that the embedding API expects.
Expand Down Expand Up @@ -843,8 +848,9 @@ - (void)swipeWithEvent:(NSEvent*)event {
- (void)touchesBeganWithEvent:(NSEvent*)event {
NSTouch* touch = event.allTouches.anyObject;
if (touch != nil) {
if ((event.timestamp - _mouseState.last_scroll_momentum_changed_time) < 0.050) {
// The trackpad has been touched within 50 ms following a scroll momentum event.
if ((event.timestamp - _mouseState.last_scroll_momentum_changed_time) <
kTrackpadTouchInertiaCancelWindowMs) {
// The trackpad has been touched following a scroll momentum event.
// A scroll inertia cancel message should be sent to the framework.
NSPoint locationInView = [self.flutterView convertPoint:event.locationInWindow fromView:nil];
NSPoint locationInBackingCoordinates =
Expand Down