Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Sources/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,12 @@ struct VerticalTabsSidebar: View {
SidebarTopScrim(height: trafficLightPadding + 20)
.allowsHitTesting(false)
}
.overlay(alignment: .top) {
// Double-click the sidebar title-bar area to zoom the
// window, matching the panel top-bar behaviour.
DoubleClickZoomView()
.frame(height: trafficLightPadding)
}
.background(Color.clear)
.modifier(ClearScrollBackground())
}
Expand Down Expand Up @@ -1920,6 +1926,28 @@ private struct SidebarTabDropDelegate: DropDelegate {
}
}

/// AppKit-level double-click handler for the sidebar title-bar area.
/// Uses NSView hit-testing so it isn't swallowed by the SwiftUI ScrollView underneath.
private struct DoubleClickZoomView: NSViewRepresentable {
func makeNSView(context: Context) -> NSView {
DoubleClickZoomNSView()
}

func updateNSView(_ nsView: NSView, context: Context) {}

private final class DoubleClickZoomNSView: NSView {
override var mouseDownCanMoveWindow: Bool { true }
override func hitTest(_ point: NSPoint) -> NSView? { self }
override func mouseDown(with event: NSEvent) {
if event.clickCount == 2 {
window?.zoom(nil)
} else {
super.mouseDown(with: event)
}
}
}
}

private struct MiddleClickCapture: NSViewRepresentable {
let onMiddleClick: () -> Void

Expand Down