autoScroll improvement for settings menu

This commit is contained in:
TrueZhuanjia committed 2025-06-10 11:56:23 +08:00
1 parent 5a77571d6f
commit 5c3a6de2b7
1 file changed
+5 -4
@@ -591,7 +591,7 @@ BOOL isCustomResolution(CGSize res) {
- (BOOL)scrolledToBottom { - (BOOL)scrolledToBottom {
CGFloat maxOffsetY = self.scrollView.contentSize.height - self.scrollView.bounds.size.height; CGFloat maxOffsetY = self.scrollView.contentSize.height - self.scrollView.bounds.size.height;
return self.scrollView.contentOffset.y >= maxOffsetY; return self.scrollView.contentOffset.y >= maxOffsetY + snapshot.bounds.size.height+50;
} }
@@ -607,9 +607,10 @@ BOOL isCustomResolution(CGSize res) {
CGFloat newY = offset.y + _scrollSpeed; CGFloat newY = offset.y + _scrollSpeed;
// 限制滚动范围 // 限制滚动范围
newY = MAX(0, MIN(newY, self.scrollView.contentSize.height - self.scrollView.bounds.size.height)); newY = MAX(0, MIN(newY, self.scrollView.contentSize.height - self.scrollView.bounds.size.height+snapshot.bounds.size.height+50));
[self.scrollView setContentOffset:CGPointMake(offset.x, newY) animated:NO]; [self.scrollView setContentOffset:CGPointMake(offset.x, newY) animated:NO];
[self updateRelocationIndicatorFor:snapshot.center];
} }
- (void)estimateFPSWithCompletion:(void (^)(CGFloat fps))completion { - (void)estimateFPSWithCompletion:(void (^)(CGFloat fps))completion {
@@ -667,7 +668,7 @@ BOOL isCustomResolution(CGSize res) {
return 0; return 0;
} }
- (void)updateRelocationIndicator:(CGPoint)locationInParentStack{ - (void)updateRelocationIndicatorFor:(CGPoint)locationInParentStack{
uint16_t currentIndex = [self parentStackIndexForLocation:locationInParentStack]; uint16_t currentIndex = [self parentStackIndexForLocation:locationInParentStack];
UIStackView* currentStack; UIStackView* currentStack;
for (NSInteger i = parentStack.arrangedSubviews.count-1; i >=0; i--) { for (NSInteger i = parentStack.arrangedSubviews.count-1; i >=0; i--) {
@@ -771,7 +772,7 @@ BOOL isCustomResolution(CGSize res) {
snapshot.center = CGPointMake(locationInParentStack.x, locationInParentStack.y); snapshot.center = CGPointMake(locationInParentStack.x, locationInParentStack.y);
NSLog(@"coordY in rootView: %f", locationInRootView.y); NSLog(@"coordY in rootView: %f", locationInRootView.y);
[self handleAutoScroll:locationInRootView]; [self handleAutoScroll:locationInRootView];
[self updateRelocationIndicator:locationInParentStack]; [self updateRelocationIndicatorFor:locationInParentStack];
break; break;