@@ -64,7 +64,7 @@ final class PlacePageScrollView: UIScrollView {
6464
6565 override func viewDidLayoutSubviews( ) {
6666 super. viewDidLayoutSubviews ( )
67- guard !self . layout. headerViewController. isEditingTitle else { return }
67+ guard !layout. headerViewController. isEditingTitle else { return }
6868 if #available( iOS 13 . 0 , * ) {
6969 // See https://github.com/organicmaps/organicmaps/issues/6917 for the details.
7070 } else if previousTraitCollection == nil {
@@ -74,6 +74,7 @@ final class PlacePageScrollView: UIScrollView {
7474 }
7575 panGesture. isEnabled = alternativeSizeClass ( iPhone: false , iPad: true )
7676 previousTraitCollection = traitCollection
77+ updateBackgroundViewFrame ( )
7778 }
7879
7980 override func viewDidAppear( _ animated: Bool ) {
@@ -163,13 +164,16 @@ final class PlacePageScrollView: UIScrollView {
163164 }
164165
165166 private func setupView( ) {
166- headerStackView . axis = . vertical
167- headerStackView . distribution = . fill
167+ view . insertSubview ( backgroundView , at : 0 )
168+ backgroundView . setStyle ( . ppBackgroundView )
168169
169170 scrollView. decelerationRate = . fast
170- scrollView. backgroundColor = . clear
171+ scrollView. setStyle ( . ppView )
171172
172- stackView. setStyle ( . ppBackgroundView)
173+ headerStackView. axis = . vertical
174+ headerStackView. distribution = . fill
175+
176+ stackView. backgroundColor = . clear
173177
174178 if isiPad {
175179 let bottomCorners : CACornerMask = [ . layerMinXMaxYCorner, . layerMaxXMaxYCorner]
@@ -193,6 +197,7 @@ final class PlacePageScrollView: UIScrollView {
193197 fillHeader ( with: layout. headerViewControllers, showSeparator: showSeparator)
194198 fillBody ( with: layout. bodyViewControllers, showSeparator: showSeparator)
195199
200+ scrollView. isScrollEnabled = true
196201 beginDragging = false
197202 if let actionBar = layout. actionBar {
198203 hideActionBar ( false )
@@ -288,6 +293,7 @@ final class PlacePageScrollView: UIScrollView {
288293 }
289294 ModalPresentationAnimator . animate ( animations: { [ weak scrollView] in
290295 scrollView? . contentOffset = contentOffset
296+ self . updateBackgroundViewFrame ( )
291297 self . layoutIfNeeded ( )
292298 } , completion: { complete in
293299 if complete {
@@ -296,6 +302,7 @@ final class PlacePageScrollView: UIScrollView {
296302 } )
297303 } else {
298304 scrollView? . contentOffset = contentOffset
305+ self . updateBackgroundViewFrame ( )
299306 completion ? ( )
300307 }
301308 }
@@ -314,6 +321,13 @@ final class PlacePageScrollView: UIScrollView {
314321 self . interactor? . updateVisibleAreaInsets ( insets)
315322 } , iPad: { } )
316323 }
324+
325+ private func updateBackgroundViewFrame( ) {
326+ backgroundView. frame = CGRect ( x: 0 ,
327+ y: max ( scrollView. origin. y, - scrollView. contentOffset. y) ,
328+ width: scrollView. width,
329+ height: stackView. height + actionBarContainerView. height)
330+ }
317331}
318332
319333// MARK: - PlacePageViewProtocol
@@ -368,6 +382,7 @@ extension PlacePageViewController: PlacePageViewProtocol {
368382 }
369383
370384 func showNextStop( ) {
385+ guard scrollView. isScrollEnabled else { return }
371386 if let nextStop = scrollSteps. last ( where: { $0. offset > scrollView. contentOffset. y } ) {
372387 scrollTo ( CGPoint ( x: 0 , y: nextStop. offset) , forced: true )
373388 }
@@ -407,6 +422,7 @@ extension PlacePageViewController: UIScrollViewDelegate {
407422 interactor? . close ( )
408423 }
409424 onOffsetChanged ( scrollView. contentOffset. y)
425+ updateBackgroundViewFrame ( )
410426 }
411427
412428 func scrollViewWillBeginDragging( _ scrollView: UIScrollView ) {
@@ -465,7 +481,7 @@ extension PlacePageViewController: UIScrollViewDelegate {
465481
466482extension PlacePageViewController : MWMKeyboardObserver {
467483 func onKeyboardWillAnimate( ) {
468- guard !isiPad else { return }
484+ guard !isiPad, isVisible else { return }
469485 scrollView. contentOffset = contentOffsetForTitleEditing ( )
470486 }
471487
0 commit comments