UIScrollView would unexpectedly change its scroll offset after updating the bounces property when dealing with small scrollable content. This fixes issue #524, "Scrolling jumps when tableView content is small".
This commit sets the initial scroll offset to the pinning offset.
The previous implementation, which set it to the current content offset,
leads various scroll tracking bugs. This reproduction is one of issues.
Using 'Scroll tracking(UITableView)' in Samples app.
1. Bounce the scroll content at the top most anchor.
2. Pull down the panel in bouncing at a minus content offset. (the
scroll content stops at the minus offset.)
3. Pull up it
The previous implementation was implemented for #526/#527. But now the
issue hasn't been reproduced in v2.5.6.
This fixes#572 to change the backdrop alpha when the view size or
its size class changes.
The main change is that `true` is passed as a
`forceLayout` parameter into `viewWillTransition(to:with:)` callbacks.
Because it's necessary for the backdrop alpha's update when the view
size or its size class changes.
This also fixes a regression at `9c45c31` commit.
```diff
- layoutAdapter.activateLayout(for: state, forceLayout: true)
+ layoutAdapter.activateLayout(for: state, forceLayout: forceLayout)
```
The behavior before the above change indicates that the method has
worked well even when `forceLayout` is set to `true` in their callbacks.
Additional improvements:
* Format `activateLayout(forceLayout:contentInsetAdjustmentBehavior:)`
* Add `_floor` function for `test_updateBackdropAlpha()`
The backdrop alpha of a panel must be updated only in `Controller.show(animated:completion:)`.
Because that prevents a backdrop flicking just before presenting a panel.
Resolve#466.
* Add test_updateBackdropAlpha
* Fix backdrop alpha's flickers in Maps.app
This issue occurs when swinging down a panel with all one's might.
The trigger is here.
```
func floatingPanelWillEndDragging(_ vc: FloatingPanelController, withVelocity velocity: CGPoint, targetState: UnsafeMutablePointer<FloatingPanelState>) {
if targetState.pointee != .full {
owner.searchVC.hideHeader(animated: true)
}
if targetState.pointee == .tip {
>>> vc.contentMode = .static
}
}
```
However, any library users expect to affect the backdrop by this code.
And then I reconsidered the reason why the backdrop alpha changes in
activateLayout(for:forceLayout:) and it's because the animation using
CAAnimation on v1.
Therefore I decided to move the point to change the backdrop alpha into
the move animation's completion handler.
And also the responsibility of `setBackdropAlpha(of:)` was moved into
`Core` because `Core` takes on a role of changing the backdrop alpha.
To fix a crash "Layout.swift: Fatal error: Attempted to read an unowned reference but the object was already deallocated" which is reported at issue #440.
This dismisses the frame 'FloatingPanel Core.move(from:to:animated:completion:)'
in the following memory leaks
> BoardServices -[BSXPCServiceConnectionEventHandler remoteTarget]
> BoardServices __63+[BSXPCServiceConnectionProxy createImplementationForProtocol:]_block_invoke
These leaks happens when a panel showes and hides using "Show Multi Panel Modal"
in the Samples app.
* Prevent a possible memory leak at Core.move(from:to:animated:completion:)
* Replace ``self`` with `self`.
* Change `LayoutAdapter.vc` property to an unowned reference
* Prevent a crash at LayoutAdapter.surfaceLocation called in `NumericSpringAnimator.update` closure.
Added an optional variable `removalInteractionVelocityThreshold` to `Behavior`, which let’s the user configure the velocity threshold for the default `floatingPanel:shouldRemoveAt:with` implementation.
* Allow open access to FloatingPanelDefaultBehavior
* Move the default presenting & dismissing animators
* Add the public initializer of FloatingPanelDefaultBehavior
* Reset the moveAnimator prop after a move animation
If `moveAnimator` isn't null, `FloatingPanelPanGestureRecognizer.touchesBegan`
detects `began` state quickly so that it doesn’t allow to work a tap gesture or
tap action in a panel.
Resolve#392
* Add 2 buttons in DebugTableViewController