mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-28 07:34:32 +00:00
Tried to fix the detach animation
This commit is contained in:
parent
f425b38a81
commit
a1678afe0a
4 changed files with 46 additions and 201 deletions
|
|
@ -209,6 +209,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||
backing: .buffered,
|
||||
defer: false
|
||||
)
|
||||
|
||||
window.animationBehavior = .none
|
||||
|
||||
window.contentView = NSHostingView(
|
||||
rootView: ContentView()
|
||||
|
|
@ -253,6 +255,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||
let animateResize = shouldAnimateResize(for: requiredSize)
|
||||
resizeWindows(to: requiredSize, animated: animateResize, force: false)
|
||||
}
|
||||
|
||||
private func updateWindowSizeForTabSwitch() {
|
||||
let requiredSize = calculateRequiredNotchSize()
|
||||
resizeWindows(to: requiredSize, animated: false, force: true)
|
||||
}
|
||||
|
||||
private func calculateRequiredNotchSize() -> CGSize {
|
||||
// Check if inline sneak peek is showing and notch is closed
|
||||
|
|
@ -321,16 +328,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||
let newY = screenFrame.origin.y + screenFrame.height - size.height
|
||||
let targetFrame = NSRect(x: newX, y: newY, width: size.width, height: size.height)
|
||||
|
||||
if animated {
|
||||
NSAnimationContext.runAnimationGroup { context in
|
||||
context.duration = 0.25
|
||||
context.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut)
|
||||
context.allowsImplicitAnimation = true
|
||||
window.animator().setFrame(targetFrame, display: true)
|
||||
}
|
||||
} else {
|
||||
window.setFrame(targetFrame, display: true)
|
||||
}
|
||||
window.setFrame(targetFrame, display: true)
|
||||
}
|
||||
|
||||
private func shouldAnimateResize(for newSize: CGSize) -> Bool {
|
||||
|
|
@ -370,9 +368,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||
// Setup Privacy Indicator Manager (camera and microphone monitoring)
|
||||
PrivacyIndicatorManager.shared.startMonitoring()
|
||||
|
||||
// Observe tab changes - use immediate updates to prevent clipping
|
||||
coordinator.$currentView.sink { [weak self] newView in
|
||||
self?.updateWindowSizeIfNeeded()
|
||||
// Observe tab changes - use immediate resize to keep the notch pinned
|
||||
coordinator.$currentView.sink { [weak self] _ in
|
||||
self?.updateWindowSizeForTabSwitch()
|
||||
}.store(in: &cancellables)
|
||||
|
||||
coordinator.$notesLayoutState
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue