Skip to content

Commit

Permalink
NSWindow+Transitions: Fixes sizing calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
jleandroperez committed Jun 20, 2024
1 parent 16801b2 commit 222ea90
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Simplenote/MagicLinkRequestedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ struct MagicLinkRequestedView: View {
.buttonStyle(PlainButtonStyle())
.padding(.bottom, Metrics.buttonPaddingBottom)
}
.frame(width: 380, height: 350)


.frame(width: 380)
.fixedSize()

/// Force Light Mode (since the Authentication UI is all light!)
.environment(\.colorScheme, .light)
}
Expand Down
7 changes: 5 additions & 2 deletions Simplenote/NSWindow+Transitions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ extension NSWindow {
/// Switches to the target ContentViewController, without animations
///
func switchContentViewController(to viewController: NSViewController) {
let newSize = viewController.view.intrinsicContentSize
var frame = frame
let targetView = viewController.view
targetView.layoutSubtreeIfNeeded()

let newSize = targetView.intrinsicContentSize

var frame = frame
frame.origin.y += frame.size.height - newSize.height
frame.size = newSize

Expand Down

0 comments on commit 222ea90

Please sign in to comment.