Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit fccefae

Browse files
committed
Address feedback
1 parent 145c2ab commit fccefae

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

shell/platform/darwin/macos/framework/Source/FlutterViewController.mm

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
static constexpr int32_t kMousePointerDeviceId = 0;
2929
static constexpr int32_t kPointerPanZoomDeviceId = 1;
3030

31+
// A trackpad touch following inertial scrolling should cause an inertia cancel
32+
// event to be issued. Use a window of 50 milliseconds after the scroll to account
33+
// for delays in event propagation observed in macOS Ventura.
34+
static constexpr double kTrackpadTouchInertiaCancelWindowMs = 0.050;
35+
3136
/**
3237
* State tracking for mouse events, to adapt between the events coming from the system and the
3338
* events that the embedding API expects.
@@ -843,8 +848,9 @@ - (void)swipeWithEvent:(NSEvent*)event {
843848
- (void)touchesBeganWithEvent:(NSEvent*)event {
844849
NSTouch* touch = event.allTouches.anyObject;
845850
if (touch != nil) {
846-
if ((event.timestamp - _mouseState.last_scroll_momentum_changed_time) < 0.050) {
847-
// The trackpad has been touched within 50 ms following a scroll momentum event.
851+
if ((event.timestamp - _mouseState.last_scroll_momentum_changed_time) <
852+
kTrackpadTouchInertiaCancelWindowMs) {
853+
// The trackpad has been touched following a scroll momentum event.
848854
// A scroll inertia cancel message should be sent to the framework.
849855
NSPoint locationInView = [self.flutterView convertPoint:event.locationInWindow fromView:nil];
850856
NSPoint locationInBackingCoordinates =

0 commit comments

Comments
 (0)