Improve macOS title bar drag area
This commit is contained in:
parent
e1413a32bd
commit
ecba775c76
1 changed files with 44 additions and 30 deletions
|
|
@ -243,13 +243,23 @@ export const TabBar = ({ paneId }: TabBarProps): React.JSX.Element => {
|
||||||
isMacElectron && isLeftmostPane
|
isMacElectron && isLeftmostPane
|
||||||
? 'var(--macos-traffic-light-padding-left, 72px)'
|
? 'var(--macos-traffic-light-padding-left, 72px)'
|
||||||
: '8px',
|
: '8px',
|
||||||
WebkitAppRegion: 'no-drag',
|
WebkitAppRegion: isMacElectron ? 'drag' : 'no-drag',
|
||||||
opacity: isFocused || paneCount === 1 ? 1 : 0.7,
|
opacity: isFocused || paneCount === 1 ? 1 : 0.7,
|
||||||
} as React.CSSProperties
|
} as React.CSSProperties
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{/* Tab list with horizontal scroll, sortable DnD, and droppable area.
|
<div
|
||||||
Capped at 75% so the drag spacer always has room to the right. */}
|
className="flex min-w-0 shrink items-center gap-1"
|
||||||
|
style={
|
||||||
|
{
|
||||||
|
WebkitAppRegion: 'no-drag',
|
||||||
|
flex: '0 1 auto',
|
||||||
|
maxWidth: 'calc(100% - 32px)',
|
||||||
|
} as React.CSSProperties
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{/* Keep the sortable list inside a no-drag group so tabs remain clickable,
|
||||||
|
while any leftover space in the pane segment can drag the window. */}
|
||||||
<div
|
<div
|
||||||
ref={(el) => {
|
ref={(el) => {
|
||||||
scrollContainerRef.current = el;
|
scrollContainerRef.current = el;
|
||||||
|
|
@ -279,6 +289,7 @@ export const TabBar = ({ paneId }: TabBarProps): React.JSX.Element => {
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</SortableContext>
|
</SortableContext>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Refresh button - show only for session tabs */}
|
{/* Refresh button - show only for session tabs */}
|
||||||
{activeTab?.type === 'session' && (
|
{activeTab?.type === 'session' && (
|
||||||
|
|
@ -298,6 +309,9 @@ export const TabBar = ({ paneId }: TabBarProps): React.JSX.Element => {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Guaranteed drag target, even when the tab list is dense. */}
|
||||||
|
<div className="min-w-8 flex-1 self-stretch" />
|
||||||
|
|
||||||
{/* Context menu */}
|
{/* Context menu */}
|
||||||
{contextMenu && contextMenuTabId && (
|
{contextMenu && contextMenuTabId && (
|
||||||
<TabContextMenu
|
<TabContextMenu
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue