Compare commits

..

2 Commits

Author SHA1 Message Date
Shadowfacts 991a106907 Add Recents widget 2022-06-20 11:32:58 -04:00
Shadowfacts 8db60a313e Fix stretchy menu interaction not working on iPad 2022-06-20 11:26:05 -04:00
3 changed files with 6 additions and 11 deletions

View File

@ -61,7 +61,8 @@ class ReadViewController: UIViewController {
navigationItem.largeTitleDisplayMode = .never
view.backgroundColor = .appBackground
view.addInteraction(StretchyMenuInteraction(delegate: self))
let menuInteraction = StretchyMenuInteraction(delegate: self)
view.addInteraction(menuInteraction)
webView = WKWebView()
webView.translatesAutoresizingMaskIntoConstraints = false
@ -77,14 +78,13 @@ 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),
// 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.trailingAnchor.constraint(equalTo: view.trailingAnchor),
webView.topAnchor.constraint(equalTo: view.topAnchor),
webView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
])

View File

@ -23,6 +23,7 @@ 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)
@ -56,6 +57,7 @@ class StretchyMenuInteraction: NSObject, UIInteraction {
panRecognizer.delegate = self
panRecognizer.allowedScrollTypesMask = [.continuous]
view.addGestureRecognizer(panRecognizer)
self.panRecognizer = panRecognizer
}
private var prevTranslation: CGFloat = 0

View File

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