fix: persist window centers and preserve them across tool size changes
This commit is contained in:
@@ -18,9 +18,11 @@ public struct LauncherAlignment: Sendable {
|
||||
)
|
||||
}
|
||||
|
||||
public static func restoredFrame(savedOrigin: CGPoint?, windowSize: CGSize, visibleFrame: CGRect) -> CGRect {
|
||||
if let savedOrigin, savedOrigin.x.isFinite, savedOrigin.y.isFinite {
|
||||
let saved = CGRect(origin: savedOrigin, size: windowSize)
|
||||
public static func restoredFrame(savedCenter: CGPoint?, windowSize: CGSize, visibleFrame: CGRect) -> CGRect {
|
||||
if let savedCenter, savedCenter.x.isFinite, savedCenter.y.isFinite {
|
||||
let saved = CGRect(x: savedCenter.x - windowSize.width / 2,
|
||||
y: savedCenter.y - windowSize.height / 2,
|
||||
width: windowSize.width, height: windowSize.height)
|
||||
if visibleFrame.contains(saved) { return saved }
|
||||
}
|
||||
var frame = LauncherAlignment(
|
||||
|
||||
Reference in New Issue
Block a user