mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-22 07:13:58 +01:00
Restore the window position of the Inspector when it’s first opened.
This commit is contained in:
parent
8a2973de36
commit
03af72bf2d
@ -74,7 +74,12 @@ final class InspectorWindowController: NSWindowController {
|
||||
inspectors = [feedInspector, folderInspector, builtinSmartFeedInspector, nothingInspector]
|
||||
currentInspector = nothingInspector
|
||||
|
||||
window?.flippedOrigin = NSPoint(x: 256, y: 256)
|
||||
if let savedOrigin = originFromDefaults() {
|
||||
window?.setFlippedOriginAdjustingForScreen(savedOrigin)
|
||||
}
|
||||
else {
|
||||
window?.flippedOrigin = NSPoint(x: 256, y: 256)
|
||||
}
|
||||
}
|
||||
|
||||
func inspector(for objects: [Any]?) -> InspectorViewController {
|
||||
@ -121,4 +126,13 @@ private extension InspectorWindowController {
|
||||
window.setFlippedOriginAdjustingForScreen(flippedOrigin)
|
||||
}
|
||||
}
|
||||
|
||||
func originFromDefaults() -> NSPoint? {
|
||||
|
||||
guard let originString = UserDefaults.standard.string(forKey: DefaultsKey.windowOrigin) else {
|
||||
return nil
|
||||
}
|
||||
let point = NSPointFromString(originString)
|
||||
return point == NSPoint.zero ? nil : point
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user