From 0ef1239283c8f4fa09c9d5168cd5e3b9ebd2ce0d Mon Sep 17 00:00:00 2001 From: daboe01 Date: Wed, 3 Sep 2025 15:21:44 +0300 Subject: [PATCH] fixed: CPScrollView did not send some notifications --- AppKit/CPScrollView.j | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/AppKit/CPScrollView.j b/AppKit/CPScrollView.j index d47126fd0..ac042e3a2 100644 --- a/AppKit/CPScrollView.j +++ b/AppKit/CPScrollView.j @@ -94,6 +94,10 @@ var TIMER_INTERVAL = 0.2, CPScrollViewFadeOutTime = 1.3; +var CPScrollViewWillStartLiveScrollNotification = @"CPScrollViewWillStartLiveScrollNotification", + CPScrollViewDidLiveScrollNotification = @"CPScrollViewDidLiveScrollNotification", + CPScrollViewDidEndLiveScrollNotification = @"CPScrollViewDidEndLiveScrollNotification"; + var CPScrollerStyleGlobal = CPScrollerStyleOverlay, CPScrollerStyleGlobalChangeNotification = @"CPScrollerStyleGlobalChangeNotification"; @@ -987,6 +991,8 @@ Notifies the delegate when the scroll view has finished scrolling. [self _sendDelegateMessages]; [_contentView scrollToPoint:contentBounds.origin]; + + [[CPNotificationCenter defaultCenter] postNotificationName:CPScrollViewDidLiveScrollNotification object:self]; } /* @ignore */ @@ -1025,6 +1031,8 @@ Notifies the delegate when the scroll view has finished scrolling. [_contentView scrollToPoint:contentBounds.origin]; [_headerClipView scrollToPoint:CGPointMake(contentBounds.origin.x, 0.0)]; + + [[CPNotificationCenter defaultCenter] postNotificationName:CPScrollViewDidLiveScrollNotification object:self]; } /* @ignore */ @@ -1035,6 +1043,7 @@ Notifies the delegate when the scroll view has finished scrolling. if (!_scrollTimer) { + [[CPNotificationCenter defaultCenter] postNotificationName:CPScrollViewWillStartLiveScrollNotification object:self]; [self _scrollViewWillScroll]; _scrollTimer = [CPTimer scheduledTimerWithTimeInterval:TIMER_INTERVAL target:self selector:@selector(_scrollViewDidScroll) userInfo:nil repeats:YES]; } @@ -1073,6 +1082,8 @@ Notifies the delegate when the scroll view has finished scrolling. [_contentView scrollToPoint:constrainedOrigin]; [_headerClipView scrollToPoint:CGPointMake(constrainedOrigin.x, 0.0)]; + [[CPNotificationCenter defaultCenter] postNotificationName:CPScrollViewDidLiveScrollNotification object:self]; + if (extraX || extraY) [enclosingScrollView _respondToScrollWheelEventWithDeltaX:extraX deltaY:extraY]; } @@ -1092,6 +1103,8 @@ Notifies the delegate when the scroll view has finished scrolling. if (_implementedDelegateMethods & CPScrollViewDelegate_scrollViewDidScroll_) [_delegate scrollViewDidScroll:self]; + + [[CPNotificationCenter defaultCenter] postNotificationName:CPScrollViewDidEndLiveScrollNotification object:self]; } /*! @ignore*/