[vlc-commits] [Git][videolan/vlc][master] 4 commits: macosx: Enable autoscroll for carousels, hacking around buggy initial presentation
Rémi Denis-Courmont (@Courmisch)
gitlab at videolan.org
Mon Feb 19 17:48:42 UTC 2024
Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC
Commits:
52cef12d by Claudio Cambra at 2024-02-19T17:25:55+00:00
macosx: Enable autoscroll for carousels, hacking around buggy initial presentation
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
80712124 by Claudio Cambra at 2024-02-19T17:25:55+00:00
macosx: Add option to disable autoscroll on carousel when interacted with
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
ac189620 by Claudio Cambra at 2024-02-19T17:25:55+00:00
macosx: Reenable auto scroll post interaction after timeout
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
b9c97261 by Claudio Cambra at 2024-02-19T17:25:55+00:00
macosx: Fix jitter on autoscroll reenable in icarousel
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
3 changed files:
- modules/gui/macosx/library/home-library/VLCLibraryHomeViewBaseCarouselContainerView.m
- modules/gui/macosx/views/iCarousel/iCarousel.h
- modules/gui/macosx/views/iCarousel/iCarousel.m
Changes:
=====================================
modules/gui/macosx/library/home-library/VLCLibraryHomeViewBaseCarouselContainerView.m
=====================================
@@ -112,6 +112,9 @@
[self updateCarouselViewHeight];
[self updateCarouselOffset];
+
+ self.carouselView.autoscroll = -.05;
+ self.carouselView.reenablePostInteractAutoscrollTimeout = 3.;
}
- (void)updateCarouselViewHeight
=====================================
modules/gui/macosx/views/iCarousel/iCarousel.h
=====================================
@@ -138,6 +138,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) BOOL scrollToItemBoundary;
@property (nonatomic, assign) BOOL ignorePerpendicularSwipes;
@property (nonatomic, assign) BOOL centerItemWhenSelected;
+ at property (assign) BOOL disableAutoscrollOnInteract;
+ at property (assign) CGFloat reenablePostInteractAutoscrollTimeout;
@property (nonatomic, readonly, getter = isDragging) BOOL dragging;
@property (nonatomic, readonly, getter = isDecelerating) BOOL decelerating;
@property (nonatomic, readonly, getter = isScrolling) BOOL scrolling;
=====================================
modules/gui/macosx/views/iCarousel/iCarousel.m
=====================================
@@ -126,6 +126,8 @@
@property (nonatomic, assign, getter = isDragging) BOOL dragging;
@property (nonatomic, assign) BOOL didDrag;
@property (nonatomic, assign) NSTimeInterval toggleTime;
+ at property NSTimer *postInteractTimer;
+ at property CGFloat priorAutoscroll;
NSComparisonResult compareViewDepth(UIView *view1, UIView *view2, iCarousel *self);
@@ -152,6 +154,9 @@ NSComparisonResult compareViewDepth(UIView *view1, UIView *view2, iCarousel *sel
_scrollToItemBoundary = YES;
_ignorePerpendicularSwipes = YES;
_centerItemWhenSelected = YES;
+ _disableAutoscrollOnInteract = YES;
+ _reenablePostInteractAutoscrollTimeout = 0.0;
+ _priorAutoscroll = 0.0;
_contentView = [[UIView alloc] initWithFrame:self.bounds];
@@ -2210,6 +2215,23 @@ NSComparisonResult compareViewDepth(UIView *view1, UIView *view2, iCarousel *sel
- (void)mouseDragged:(NSEvent *)theEvent
{
+ if (self.disableAutoscrollOnInteract && self.autoscroll != 0.0) {
+ self.priorAutoscroll = self.autoscroll;
+ self.autoscroll = 0;
+
+ if (self.reenablePostInteractAutoscrollTimeout > 0.0) {
+ if (self.postInteractTimer != nil && self.postInteractTimer.valid) {
+ [self.postInteractTimer invalidate];
+ self.postInteractTimer = nil;
+ }
+
+ self.postInteractTimer = [NSTimer scheduledTimerWithTimeInterval:self.reenablePostInteractAutoscrollTimeout repeats:NO block:^(NSTimer * const timer){
+ self.lastTime = CACurrentMediaTime();
+ self.autoscroll = self.priorAutoscroll;
+ }];
+ }
+ }
+
_didDrag = YES;
if (_scrollEnabled)
{
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ffd3f0e70a1b61d9d919387fa14558c1d4bf7881...b9c9726147188aa390e06998981ad92cc6befa19
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ffd3f0e70a1b61d9d919387fa14558c1d4bf7881...b9c9726147188aa390e06998981ad92cc6befa19
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list