native macOS codings agent orchestrator
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #43 from onevcat/feature/canvas-card-titlebar-double-click

Add double-click on canvas card title bar to switch to tab view

authored by

Wei Wang and committed by
GitHub
a4284433 09316b8a

+21 -1
+3
supacode/Features/Canvas/Views/CanvasCardView.swift
··· 14 14 let onResize: (CardResizeEdge, CGSize) -> Void 15 15 let onResizeEnd: () -> Void 16 16 let onSplitOperation: (TerminalSplitTreeView.Operation) -> Void 17 + let onTitleBarTap: () -> Void 17 18 18 19 enum CardResizeEdge { 19 20 case leading, trailing, top, bottom ··· 83 84 } 84 85 } 85 86 .background(.bar) 87 + .accessibilityAddTraits(.isButton) 88 + .onTapGesture { onTitleBarTap() } 86 89 .gesture( 87 90 DragGesture(coordinateSpace: .global) 88 91 .updating($dragTranslation) { value, state, _ in
+15
supacode/Features/Canvas/Views/CanvasView.swift
··· 3 3 4 4 struct CanvasView: View { 5 5 let terminalManager: WorktreeTerminalManager 6 + var onExitToTab: () -> Void = {} 6 7 @State private var layoutStore = CanvasLayoutStore() 7 8 8 9 @State private var canvasOffset: CGSize = .zero ··· 10 11 @State private var canvasScale: CGFloat = 1.0 11 12 @State private var lastCanvasScale: CGFloat = 1.0 12 13 @State private var focusedTabID: TerminalTabID? 14 + @State private var lastTitleBarTapDate: Date = .distantPast 13 15 @State private var activeResize: [TerminalTabID: ActiveResize] = [:] 14 16 @State private var hasPerformedInitialFit = false 15 17 @State private var viewportSize: CGSize = .zero ··· 80 82 onResizeEnd: { commitResize(for: tab.id, cardKey: cardKey, surfaces: tree.leaves()) }, 81 83 onSplitOperation: { operation in 82 84 state.performSplitOperation(operation, in: tab.id) 85 + }, 86 + onTitleBarTap: { 87 + let wasAlreadyFocused = focusedTabID == tab.id 88 + if let activeSurface = state.surfaceView(for: tab.id) { 89 + focusCard(tab.id, surfaceView: activeSurface, states: activeStates) 90 + } 91 + let now = Date() 92 + if wasAlreadyFocused, 93 + now.timeIntervalSince(lastTitleBarTapDate) <= NSEvent.doubleClickInterval 94 + { 95 + onExitToTab() 96 + } 97 + lastTitleBarTapDate = now 83 98 } 84 99 ) 85 100 .scaleEffect(canvasScale, anchor: .center)
+3 -1
supacode/Features/Repositories/Views/WorktreeDetailView.swift
··· 148 148 selectedWorktreeSummaries: [MultiSelectedWorktreeSummary] 149 149 ) -> some View { 150 150 if repositories.isShowingCanvas { 151 - CanvasView(terminalManager: terminalManager) 151 + CanvasView(terminalManager: terminalManager, onExitToTab: { 152 + store.send(.repositories(.toggleCanvas)) 153 + }) 152 154 } else if repositories.isShowingArchivedWorktrees { 153 155 ArchivedWorktreesDetailView( 154 156 store: store.scope(state: \.repositories, action: \.repositories)