Compare commits
2 Commits
ae0c91d719
...
991a106907
Author | SHA1 | Date |
---|---|---|
Shadowfacts | 991a106907 | |
Shadowfacts | 8db60a313e |
|
@ -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),
|
||||
])
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue