Compare commits

..

3 Commits

3 changed files with 11 additions and 6 deletions

View File

@ -61,8 +61,7 @@ class ReadViewController: UIViewController {
navigationItem.largeTitleDisplayMode = .never
view.backgroundColor = .appBackground
let menuInteraction = StretchyMenuInteraction(delegate: self)
view.addInteraction(menuInteraction)
view.addInteraction(StretchyMenuInteraction(delegate: self))
webView = WKWebView()
webView.translatesAutoresizingMaskIntoConstraints = false
@ -78,13 +77,14 @@ class ReadViewController: UIViewController {
if let content = itemContentHTML() {
webView.loadHTMLString(content, baseURL: item.url)
}
webView.scrollView.alwaysBounceVertical = true
webView.scrollView.alwaysBounceHorizontal = false
webView.scrollView.panGestureRecognizer.require(toFail: menuInteraction.panRecognizer!)
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),
])

View File

@ -23,7 +23,6 @@ class StretchyMenuInteraction: NSObject, UIInteraction {
weak var delegate: StretchyMenuInteractionDelegate?
private(set) weak var view: UIView? = nil
private(set) var panRecognizer: UIPanGestureRecognizer?
private let menuHintView = MenuHintView()
fileprivate let feedbackGenerator = UIImpactFeedbackGenerator(style: .medium)
@ -57,7 +56,6 @@ class StretchyMenuInteraction: NSObject, UIInteraction {
panRecognizer.delegate = self
panRecognizer.allowedScrollTypesMask = [.continuous]
view.addGestureRecognizer(panRecognizer)
self.panRecognizer = panRecognizer
}
private var prevTranslation: CGFloat = 0

View File

@ -16,6 +16,13 @@ body {
background-color: var(--background-color);
}
@media (min-width: 696px) {
body {
width: 672px;
margin: 12px auto;
}
}
a {
color: var(--tint-color);
}