diff --git a/Sources/Bonsplit/Internal/Views/TabBarView.swift b/Sources/Bonsplit/Internal/Views/TabBarView.swift index e14b6e96..4f2a5d38 100644 --- a/Sources/Bonsplit/Internal/Views/TabBarView.swift +++ b/Sources/Bonsplit/Internal/Views/TabBarView.swift @@ -249,6 +249,7 @@ struct TabBarView: View { dlog("tab.close pane=\(pane.id.id.uuidString.prefix(5)) tab=\(tab.id.uuidString.prefix(5)) title=\"\(tab.title)\"") #endif withTransaction(Transaction(animation: nil)) { + controller.onTabCloseRequest?(TabID(id: tab.id), pane.id) _ = controller.closeTab(TabID(id: tab.id), inPane: pane.id) } }, diff --git a/Sources/Bonsplit/Internal/Views/TabItemView.swift b/Sources/Bonsplit/Internal/Views/TabItemView.swift index bc23a339..60ebfb10 100644 --- a/Sources/Bonsplit/Internal/Views/TabItemView.swift +++ b/Sources/Bonsplit/Internal/Views/TabItemView.swift @@ -181,6 +181,9 @@ struct TabItemView: View { guard !tab.isPinned else { return } onClose() })) + .onTapGesture(count: 2) { + onZoomToggle() + } .onTapGesture { onSelect() } diff --git a/Sources/Bonsplit/Public/BonsplitController.swift b/Sources/Bonsplit/Public/BonsplitController.swift index a44f7688..653f19f4 100644 --- a/Sources/Bonsplit/Public/BonsplitController.swift +++ b/Sources/Bonsplit/Public/BonsplitController.swift @@ -51,6 +51,10 @@ public final class BonsplitController { /// Return `true` when the drop has been handled by the host application. @ObservationIgnored public var onExternalTabDrop: ((ExternalTabDropRequest) -> Bool)? + /// Called when the user explicitly requests to close a tab from the tab strip UI. + /// Internal host-driven closes should not use this hook. + @ObservationIgnored public var onTabCloseRequest: ((_ tabId: TabID, _ paneId: PaneID) -> Void)? + // MARK: - Internal State internal var internalController: SplitViewController