fix: restore positive resize increments when clearing aspect lock
This commit is contained in:
@@ -20,6 +20,7 @@ final class CompactWindowController: NSObject {
|
||||
let minSize: NSSize
|
||||
let contentMinSize: NSSize
|
||||
let aspectRatio: NSSize
|
||||
let resizeIncrements: NSSize
|
||||
let styleMask: NSWindow.StyleMask
|
||||
let titleVisibility: NSWindow.TitleVisibility
|
||||
let titlebarAppearsTransparent: Bool
|
||||
@@ -34,6 +35,7 @@ final class CompactWindowController: NSObject {
|
||||
minSize = window.minSize
|
||||
contentMinSize = window.contentMinSize
|
||||
aspectRatio = window.aspectRatio
|
||||
resizeIncrements = window.resizeIncrements
|
||||
styleMask = window.styleMask
|
||||
titleVisibility = window.titleVisibility
|
||||
titlebarAppearsTransparent = window.titlebarAppearsTransparent
|
||||
@@ -310,7 +312,11 @@ final class CompactWindowController: NSObject {
|
||||
window.minSize = snapshot.minSize
|
||||
window.contentMinSize = snapshot.contentMinSize
|
||||
window.setFrame(snapshot.frame, display: true)
|
||||
window.aspectRatio = snapshot.aspectRatio
|
||||
if snapshot.aspectRatio == .zero {
|
||||
window.resizeIncrements = snapshot.resizeIncrements
|
||||
} else {
|
||||
window.aspectRatio = snapshot.aspectRatio
|
||||
}
|
||||
self.snapshot = nil
|
||||
}
|
||||
|
||||
@@ -380,7 +386,7 @@ final class CompactWindowController: NSObject {
|
||||
frame.origin.x = min(max(window.frame.minX, usable.minX), usable.maxX - frame.width)
|
||||
frame.origin.y = min(max(window.frame.minY, usable.minY), usable.maxY - frame.height)
|
||||
}
|
||||
window.aspectRatio = .zero
|
||||
window.resizeIncrements = NSSize(width: 1, height: 1)
|
||||
animateFrame(frame, of: window, animated: animated) { [weak self, weak window] in
|
||||
guard let self, let window else { return }
|
||||
if Self.canFitAspect(aspect, available: usable.size) {
|
||||
|
||||
Reference in New Issue
Block a user