mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-03 04:17:44 +01:00
Maintain scroll position when changing themes
This commit is contained in:
parent
baad458138
commit
abd66ea1bb
@ -487,16 +487,16 @@
|
|||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="7UM-iq-OLB" customClass="PreferencesTableViewBackgroundView" customModule="NetNewsWire" customModuleProvider="target">
|
<customView translatesAutoresizingMaskIntoConstraints="NO" id="7UM-iq-OLB" customClass="PreferencesTableViewBackgroundView" customModule="NetNewsWire" customModuleProvider="target">
|
||||||
<rect key="frame" x="20" y="44" width="180" height="229"/>
|
<rect key="frame" x="20" y="44" width="180" height="228"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="26" horizontalPageScroll="10" verticalLineScroll="26" verticalPageScroll="10" hasHorizontalScroller="NO" horizontalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="PaF-du-r3c">
|
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="26" horizontalPageScroll="10" verticalLineScroll="26" verticalPageScroll="10" hasHorizontalScroller="NO" horizontalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="PaF-du-r3c">
|
||||||
<rect key="frame" x="1" y="1" width="178" height="227"/>
|
<rect key="frame" x="1" y="1" width="178" height="226"/>
|
||||||
<clipView key="contentView" id="cil-Gq-akO">
|
<clipView key="contentView" id="cil-Gq-akO">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="178" height="227"/>
|
<rect key="frame" x="0.0" y="0.0" width="178" height="226"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="fullWidth" columnReordering="NO" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="24" viewBased="YES" id="aTp-KR-y6b">
|
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="fullWidth" columnReordering="NO" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="24" viewBased="YES" id="aTp-KR-y6b">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="178" height="227"/>
|
<rect key="frame" x="0.0" y="0.0" width="178" height="226"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<size key="intercellSpacing" width="3" height="2"/>
|
<size key="intercellSpacing" width="3" height="2"/>
|
||||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||||
@ -603,7 +603,7 @@
|
|||||||
<rect key="frame" x="83" y="20" width="117" height="24"/>
|
<rect key="frame" x="83" y="20" width="117" height="24"/>
|
||||||
</customView>
|
</customView>
|
||||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Y7D-xQ-wep">
|
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Y7D-xQ-wep">
|
||||||
<rect key="frame" x="208" y="20" width="222" height="253"/>
|
<rect key="frame" x="208" y="20" width="222" height="252"/>
|
||||||
</customView>
|
</customView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
@ -658,16 +658,16 @@
|
|||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="pjs-G4-byk" customClass="PreferencesTableViewBackgroundView" customModule="NetNewsWire" customModuleProvider="target">
|
<customView translatesAutoresizingMaskIntoConstraints="NO" id="pjs-G4-byk" customClass="PreferencesTableViewBackgroundView" customModule="NetNewsWire" customModuleProvider="target">
|
||||||
<rect key="frame" x="20" y="44" width="180" height="229"/>
|
<rect key="frame" x="20" y="44" width="180" height="228"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="26" horizontalPageScroll="10" verticalLineScroll="26" verticalPageScroll="10" hasHorizontalScroller="NO" horizontalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="29T-r2-ckC">
|
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="26" horizontalPageScroll="10" verticalLineScroll="26" verticalPageScroll="10" hasHorizontalScroller="NO" horizontalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="29T-r2-ckC">
|
||||||
<rect key="frame" x="1" y="1" width="178" height="227"/>
|
<rect key="frame" x="1" y="1" width="178" height="226"/>
|
||||||
<clipView key="contentView" id="dXw-GY-TP8">
|
<clipView key="contentView" id="dXw-GY-TP8">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="178" height="227"/>
|
<rect key="frame" x="0.0" y="0.0" width="178" height="226"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="fullWidth" columnReordering="NO" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="24" viewBased="YES" id="dfn-Vn-oDp">
|
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="fullWidth" columnReordering="NO" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="24" viewBased="YES" id="dfn-Vn-oDp">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="178" height="227"/>
|
<rect key="frame" x="0.0" y="0.0" width="178" height="226"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<size key="intercellSpacing" width="3" height="2"/>
|
<size key="intercellSpacing" width="3" height="2"/>
|
||||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||||
@ -770,7 +770,7 @@
|
|||||||
<rect key="frame" x="83" y="20" width="117" height="24"/>
|
<rect key="frame" x="83" y="20" width="117" height="24"/>
|
||||||
</customView>
|
</customView>
|
||||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="N1N-pE-gBL">
|
<customView translatesAutoresizingMaskIntoConstraints="NO" id="N1N-pE-gBL">
|
||||||
<rect key="frame" x="208" y="20" width="222" height="253"/>
|
<rect key="frame" x="208" y="20" width="222" height="252"/>
|
||||||
</customView>
|
</customView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
|
@ -55,6 +55,7 @@ final class DetailWebViewController: NSViewController {
|
|||||||
|
|
||||||
private let detailIconSchemeHandler = DetailIconSchemeHandler()
|
private let detailIconSchemeHandler = DetailIconSchemeHandler()
|
||||||
private var waitingForFirstReload = false
|
private var waitingForFirstReload = false
|
||||||
|
private var windowScrollY: CGFloat?
|
||||||
private let keyboardDelegate = DetailKeyboardDelegate()
|
private let keyboardDelegate = DetailKeyboardDelegate()
|
||||||
|
|
||||||
private struct MessageName {
|
private struct MessageName {
|
||||||
@ -143,7 +144,10 @@ final class DetailWebViewController: NSViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objc func currentArticleThemeDidChangeNotification(_ note: Notification) {
|
@objc func currentArticleThemeDidChangeNotification(_ note: Notification) {
|
||||||
reloadHTML()
|
fetchScrollInfo() { scrollInfo in
|
||||||
|
self.windowScrollY = scrollInfo?.offsetY
|
||||||
|
self.reloadHTML()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Media Functions
|
// MARK: Media Functions
|
||||||
@ -226,6 +230,11 @@ extension DetailWebViewController: WKNavigationDelegate, WKUIDelegate {
|
|||||||
webView.isHidden = false
|
webView.isHidden = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let windowScrollY = windowScrollY {
|
||||||
|
webView.evaluateJavaScript("window.scrollTo(0, \(windowScrollY));")
|
||||||
|
self.windowScrollY = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WKUIDelegate
|
// WKUIDelegate
|
||||||
|
Loading…
x
Reference in New Issue
Block a user