Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Sources/Controller.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ import os.log
shouldAllowToScroll scrollView: UIScrollView,
in state: FloatingPanelState
) -> Bool

/// Determines whether the scroll content should be locked during transition to the specified state. If not implemented, the content will always be locked.
@objc(floatingPanel:shouldLockScrollView:transitioningToState:)
optional func floatingPanel(_ fpc: FloatingPanelController, shouldLockScrollView scrollView: UIScrollView, transitioningToState state: FloatingPanelState) -> Bool
}

///
Expand Down
4 changes: 2 additions & 2 deletions Sources/Core.swift
Original file line number Diff line number Diff line change
Expand Up @@ -933,8 +933,8 @@ class Core: NSObject, UIGestureRecognizerDelegate {
let translation = data.value - initialData.value
self.backdropView.alpha = self.getBackdropAlpha(at: current, with: translation)

// Pin the offset of the tracking scroll view while moving by this animator
if let scrollView = self.scrollView {
// Pin the offset of the tracking scroll view while moving by this animator, unless the delegate decides otherwise
if let scrollView = self.scrollView, ownerVC.delegate?.floatingPanel?(ownerVC, shouldLockScrollView: scrollView, transitioningToState: state) ?? true {
self.stopScrolling(at: self.initialScrollOffset)
os_log(msg, log: devLog, type: .debug, "move -- pinning scroll offset = \(scrollView.contentOffset)")
}
Expand Down