macos: don't create drop zone at all if self dragging

This commit is contained in:
Mitchell Hashimoto
2025-12-29 06:12:41 -08:00
parent e1f22472f6
commit e56dce3d84

View File

@@ -99,12 +99,20 @@ fileprivate struct TerminalSplitLeaf: View {
Ghostty.InspectableSurface(
surfaceView: surfaceView,
isSplit: isSplit)
.onDrop(of: [.ghosttySurfaceId], delegate: SplitDropDelegate(
dropState: $dropState,
viewSize: geometry.size,
destinationSurface: surfaceView,
action: action
))
.background {
// If we're dragging ourself, we hide the entire drop zone. This makes
// it so that a released drop animates back to its source properly
// so it is a proper invalid drop zone.
if !isSelfDragging {
Color.clear
.onDrop(of: [.ghosttySurfaceId], delegate: SplitDropDelegate(
dropState: $dropState,
viewSize: geometry.size,
destinationSurface: surfaceView,
action: action
))
}
}
.overlay {
if !isSelfDragging, case .dropping(let zone) = dropState {
zone.overlay(in: geometry)
@@ -113,6 +121,9 @@ fileprivate struct TerminalSplitLeaf: View {
}
.onPreferenceChange(Ghostty.DraggingSurfaceKey.self) { value in
isSelfDragging = value == surfaceView.id
if isSelfDragging {
dropState = .idle
}
}
.accessibilityElement(children: .contain)
.accessibilityLabel("Terminal pane")