From 168c5abbcf47355830d1bfd1f0c805a02493f5de Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 20 Jun 2022 11:26:05 -0400 Subject: [PATCH] Fix stretchy menu interaction not working on iPad --- Reader/Screens/Read/ReadViewController.swift | 5 ++++- Reader/StretchyMenuInteraction.swift | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Reader/Screens/Read/ReadViewController.swift b/Reader/Screens/Read/ReadViewController.swift index a7133cc..0477fc0 100644 --- a/Reader/Screens/Read/ReadViewController.swift +++ b/Reader/Screens/Read/ReadViewController.swift @@ -77,11 +77,14 @@ class ReadViewController: UIViewController { if let content = itemContentHTML() { webView.loadHTMLString(content, baseURL: item.url) } + webView.scrollView.alwaysBounceVertical = true + webView.scrollView.alwaysBounceHorizontal = false view.addSubview(webView) NSLayoutConstraint.activate([ webView.leadingAnchor.constraint(equalTo: view.leadingAnchor), - webView.trailingAnchor.constraint(equalTo: view.trailingAnchor), + // subtract 0.5, because otherwise, on ipad, the web view's scroll content view ends up being wider than the scroll view itself, causing the content to bounce horizontally + webView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -0.5), webView.topAnchor.constraint(equalTo: view.topAnchor), webView.bottomAnchor.constraint(equalTo: view.bottomAnchor), ]) diff --git a/Reader/StretchyMenuInteraction.swift b/Reader/StretchyMenuInteraction.swift index 33b52eb..841af89 100644 --- a/Reader/StretchyMenuInteraction.swift +++ b/Reader/StretchyMenuInteraction.swift @@ -56,7 +56,6 @@ class StretchyMenuInteraction: NSObject, UIInteraction { panRecognizer.delegate = self panRecognizer.allowedScrollTypesMask = [.continuous] view.addGestureRecognizer(panRecognizer) - } private var prevTranslation: CGFloat = 0