Skip to content

Open source CapCut alternative.

TypeScript

fix(app): overlay stability — avoid the resize crash and enable composer paste

David Lec649ec7fdd3b
diff --git a/apps/Donkey/Sources/Donkey/PointerCoachCursorOverlayController.swift b/apps/Donkey/Sources/Donkey/PointerCoachCursorOverlayController.swift
index 44ec165b..e37ae67a 100644
--- a/apps/Donkey/Sources/Donkey/PointerCoachCursorOverlayController.swift
+++ b/apps/Donkey/Sources/Donkey/PointerCoachCursorOverlayController.swift
@@ -27,6 +27,9 @@ final class PointerCoachCursorOverlayController {
viewModel.updateViewport(origin: localFrame.origin, size: localFrame.size)
let hostingView = NSHostingView(rootView: PointerCoachCursorOverlayView(viewModel: viewModel))
+ // The controller owns the panel frame; stop the hosting view from also bridging its content size
+ // to the window, which re-enters layout mid display-cycle and crashes (see the spawn overlay).
+ hostingView.sizingOptions = []
hostingView.frame = CGRect(origin: .zero, size: localFrame.size)
hostingView.autoresizingMask = [.width, .height]
hostingView.wantsLayer = true
diff --git a/apps/Donkey/Sources/Donkey/UserQueryOverlayController.swift b/apps/Donkey/Sources/Donkey/UserQueryOverlayController.swift
index 59726cca..69cb7283 100644
--- a/apps/Donkey/Sources/Donkey/UserQueryOverlayController.swift
+++ b/apps/Donkey/Sources/Donkey/UserQueryOverlayController.swift
@@ -105,6 +105,10 @@ final class UserQueryOverlayController {
}
)
)
+ // The controller positions and sizes this panel itself; stop the hosting view from also bridging
+ // its SwiftUI content size to the window, which re-enters layout mid display-cycle and throws an
+ // uncaught AppKit exception (see the spawn overlay).
+ hostingView.sizingOptions = []
hostingView.frame = CGRect(origin: .zero, size: size)
hostingView.autoresizingMask = [.width, .height]
hostingView.wantsLayer = true
@@ -153,6 +157,11 @@ final class UserQueryOverlayController {
private func makeStatusPanel() -> NSPanel {
let metrics = notchMetrics()
let hostingView = UserQueryHostingView(rootView: notchStatusView(metrics: metrics))
+ // The notch status panel is resized explicitly on every step (narration updates, expand/collapse
+ // animations). Letting the hosting view ALSO animate the window size from content re-enters layout
+ // during the display cycle and crashes the app (uncaught AppKit exception) — the exact failure seen
+ // while driving a vision step. Empty sizingOptions makes our explicit frame the only sizing path.
+ hostingView.sizingOptions = []
hostingView.frame = CGRect(origin: .zero, size: metrics.surfaceSize)
hostingView.autoresizingMask = [.width, .height]
hostingView.wantsLayer = true
diff --git a/apps/Donkey/Sources/Donkey/UserQuerySpawnOverlayController.swift b/apps/Donkey/Sources/Donkey/UserQuerySpawnOverlayController.swift
index 2d0ed79b..496aad23 100644
--- a/apps/Donkey/Sources/Donkey/UserQuerySpawnOverlayController.swift
+++ b/apps/Donkey/Sources/Donkey/UserQuerySpawnOverlayController.swift
@@ -275,6 +275,13 @@ final class UserQuerySpawnOverlayController {
let hostingView = UserQuerySpawnHostingView(
rootView: UserQuerySpawnOverlayView(viewModel: viewModel)
)
+ // This controller drives the panel frame itself (travel animation, label-layout callbacks). Let
+ // the hosting view ALSO bridge its SwiftUI content size to the window and the two re-enter
+ // layout — `NSHostingView.windowDidLayout` → `updateAnimatedWindowSize` resizes the window mid
+ // display-cycle and AppKit throws an uncaught exception (SIGABRT) during a cursor-travel step.
+ // Empty sizingOptions makes the hosting view a passive content view, so only our explicit frame
+ // updates move the panel.
+ hostingView.sizingOptions = []
hostingView.frame = CGRect(origin: .zero, size: globalFrame.size)
hostingView.autoresizingMask = [.width, .height]
hostingView.wantsLayer = true
diff --git a/apps/Donkey/Sources/DonkeyUI/UserQuerySpawnOverlayView.swift b/apps/Donkey/Sources/DonkeyUI/UserQuerySpawnOverlayView.swift
index e684ebbf..69637124 100644
--- a/apps/Donkey/Sources/DonkeyUI/UserQuerySpawnOverlayView.swift
+++ b/apps/Donkey/Sources/DonkeyUI/UserQuerySpawnOverlayView.swift
@@ -842,8 +842,12 @@ public struct UserQuerySpawnOverlayView: View {
isLabelHovered = hovering
}
.overlay(alignment: .topTrailing) {
+ // Keep the button inside the label's bounds. An `.offset` that pushes it
+ // past the top-trailing corner still renders but is not hit-testable
+ // outside the parent frame, leaving only a sliver of the X clickable.
dismissButton
- .offset(x: 6, y: -6)
+ .padding(.top, 2)
+ .padding(.trailing, 2)
.opacity(showsDismissButton ? 1 : 0)
.allowsHitTesting(showsDismissButton)
.onHover { hovering in