Move live-resize handler from detail container to DetailWebView, where it belongs.

This commit is contained in:
Brent Simmons 2019-02-12 18:18:08 -08:00
parent 28466a3fea
commit 104445c413
2 changed files with 9 additions and 18 deletions

View File

@ -108,16 +108,6 @@ final class DetailViewController: NSViewController, WKUIDelegate {
let timelineArticles = userInfo[UserInfoKey.articles] as? ArticleArray
articles = timelineArticles
}
func viewWillStartLiveResize() {
webview.evaluateJavaScript("document.body.style.overflow = 'hidden';", completionHandler: nil)
}
func viewDidEndLiveResize() {
webview.evaluateJavaScript("document.body.style.overflow = 'visible';", completionHandler: nil)
}
}
// MARK: WKNavigationDelegate
@ -236,14 +226,6 @@ final class DetailContainerView: NSView {
}
}
override func viewWillStartLiveResize() {
viewController?.viewWillStartLiveResize()
}
override func viewDidEndLiveResize() {
viewController?.viewDidEndLiveResize()
}
override func draw(_ dirtyRect: NSRect) {
NSColor.textBackgroundColor.setFill()
dirtyRect.fill()

View File

@ -36,6 +36,15 @@ final class DetailWebView: WKWebView {
evaluateJavaScript("document.getElementById('bodyId').className = '\(bodyClass)'")
}
override func viewWillStartLiveResize() {
super.viewWillStartLiveResize()
evaluateJavaScript("document.body.style.overflow = 'hidden';", completionHandler: nil)
}
override func viewDidEndLiveResize() {
super.viewDidEndLiveResize()
evaluateJavaScript("document.body.style.overflow = 'visible';", completionHandler: nil)
}
}
private extension NSUserInterfaceItemIdentifier {