Keep the prefs window width constant between panes. Keep the top edge of the window constant.
This commit is contained in:
parent
7f731164a3
commit
8a0f65dd24
|
@ -29,6 +29,7 @@ private struct ToolbarItemIdentifier {
|
|||
class PreferencesWindowController : NSWindowController, NSToolbarDelegate {
|
||||
|
||||
private let windowFrameName = "Preferences"
|
||||
private let windowWidth = CGFloat(512.0) // Width is constant for all views; only the height changes
|
||||
private var viewControllers = [String: NSViewController]()
|
||||
private let toolbarItemSpecs: [PreferencesToolbarItemSpec] = {
|
||||
var specs = [PreferencesToolbarItemSpec]()
|
||||
|
@ -37,7 +38,6 @@ class PreferencesWindowController : NSWindowController, NSToolbarDelegate {
|
|||
return specs
|
||||
}()
|
||||
|
||||
|
||||
override func windowDidLoad() {
|
||||
|
||||
let toolbar = NSToolbar(identifier: NSToolbar.Identifier("PreferencesToolbar"))
|
||||
|
@ -165,22 +165,22 @@ private extension PreferencesWindowController {
|
|||
}
|
||||
|
||||
func resizeWindow(toFitView view: NSView) {
|
||||
|
||||
let viewFrame = view.frame
|
||||
let windowFrame = window!.frame
|
||||
let contentViewFrame = window!.contentView!.frame
|
||||
|
||||
let deltaHeight = NSHeight(contentViewFrame) - NSHeight(viewFrame)
|
||||
let heightForWindow = NSHeight(windowFrame) - deltaHeight
|
||||
let windowOriginY = NSMinY(windowFrame)// + deltaHeight
|
||||
let windowOriginY = NSMinY(windowFrame) + deltaHeight
|
||||
|
||||
var updatedWindowFrame = windowFrame
|
||||
updatedWindowFrame.size.height = heightForWindow
|
||||
updatedWindowFrame.origin.y = windowOriginY
|
||||
updatedWindowFrame.size.width = NSWidth(viewFrame)
|
||||
updatedWindowFrame.size.width = windowWidth //NSWidth(viewFrame)
|
||||
|
||||
var updatedViewFrame = viewFrame
|
||||
updatedViewFrame.origin = NSZeroPoint
|
||||
updatedViewFrame.size.width = windowWidth
|
||||
if viewFrame != updatedViewFrame {
|
||||
view.frame = updatedViewFrame
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue