Compare commits
3 Commits
991a106907
...
ae0c91d719
Author | SHA1 | Date |
---|---|---|
Shadowfacts | ae0c91d719 | |
Shadowfacts | 941bc4713e | |
Shadowfacts | 168c5abbcf |
|
@ -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),
|
||||
])
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue