Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Prev Previous commit
Next Next commit
nits
  • Loading branch information
luckysmg committed Aug 27, 2022
commit 4bf7f3f3876694f9873556f024bee8f202b48681
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ @interface FlutterViewController () <FlutterBinaryMessenger, UIScrollViewDelegat
@property(nonatomic, assign) double targetViewInsetBottom;
@property(nonatomic, retain) VSyncClient* keyboardAnimationVSyncClient;

/// VSyncClient for touch callback's rate correction.
/// VSyncClient for touch events delivery frame rate correction.
///
/// On promotion devices(eg: iPhone13 Pro), the delivery frame rate of touch events is 60HZ
/// but the frame rate of rendering is 120HZ, which is different and will leads junk and laggy.
/// With this VSyncClient, we can correct the delivery frame rate of touch events to let it keep
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use we in comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done^_^

/// the same with frame rate of rendering.
@property(nonatomic, retain) VSyncClient* touchRateCorrectionVSyncClient;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is VSyncClient necessary here? Since this is just for increasing resolution of touch events and doesn't directly affect rendering, should we just use CADisplayLink directly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using VSyncClient ensures the preferred frame rate that used is the same as the one used on UIThread.


/*
Expand Down Expand Up @@ -674,7 +679,7 @@ - (void)viewDidLoad {
// Register internal plugins.
[self addInternalPlugins];

// Create a vsync client to correct touch rate if needed.
// Create a vsync client to correct delivery frame rate of touch events if needed.
[self createTouchRateCorrectionVSyncClientIfNeeded];

if (@available(iOS 13.4, *)) {
Expand Down Expand Up @@ -973,7 +978,7 @@ - (void)dispatchTouches:(NSSet*)touches
}
}

// Activate or pause touch rate correction according to the touches when user is interacting.
// Activate or pause the correction of delivery frame rate of touch events.
[self triggerTouchRateCorrectionIfNeeded:touches];

const CGFloat scale = [UIScreen mainScreen].scale;
Expand Down