mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-11 01:39:41 +02:00
fix(tabs): wrap case clusters box by box and never route a lineage line through a tab
With tabArrangement 'case' at 1440px (nine tabs in four cases), the lineage routes ran horizontally through the middle of tabs, cluster labels and box borders. #538's clusters are `max-width: 100%` boxes that may shrink, so in the one-line strip every box squeezed and wrapped inside itself (a one-tab case's swatch alone on a line above its tab). The strip then never overflowed, so updateTabOverflowMode() never wrapped it, and #544's routing room (`.lineage-tree.tabs-auto-wrap`: row gap and spine channel) never applied. computeLineageRows grouped the squeezed tabs by top alone into rows that overlap (10-40, 20-50, 42-74), and gapUnder put the first row's gap at y 30, inside the tabs below it. - On the desktop header strip a cluster keeps its width, so clusters that do not fit overflow and the strip wraps box by box; the boxes' own gaps read --lineage-row-gap, so the routes run between box rows and through the spine channel. A case wider than the whole strip still wraps inside its box, and now wraps the strip too (`_tabClustersWrapInside`, the new `innerWrap` input of shouldAutoWrapTabs), so its inner rows get the gap. - computeLineageRows never returns overlapping rows: tabs whose spans overlap are one row. gapUnder returns null when there is no real gap, and a route with no gap is not drawn. A final pass drops any route with a segment inside a tab, so no arrangement can draw a line through a tab (a layout without the room loses lines instead). Pinned with the squeezed rects measured live. At 1920px, where the clusters fit on one line, nothing changes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6359,12 +6359,29 @@ class CodemanApp {
|
||||
tabCount: this.sessions.size,
|
||||
scrollWidth: container.scrollWidth,
|
||||
clientWidth: container.clientWidth,
|
||||
innerWrap: container.classList.contains('tabs-clusters') && this._tabClustersWrapInside(container),
|
||||
})
|
||||
: container.scrollWidth > container.clientWidth + 1;
|
||||
|
||||
container.classList.toggle('tabs-auto-wrap', shouldWrap);
|
||||
}
|
||||
|
||||
/**
|
||||
* True when a case cluster in the header strip wraps inside its own box: a case
|
||||
* wider than the whole strip (styles.css caps a box at the strip's width). The
|
||||
* strip then has rows although it never overflows, so it must still wrap, or
|
||||
* the lineage routing room (`.lineage-tree.tabs-auto-wrap`) is never reserved
|
||||
* and the routes have no gap between the box's rows to run in. Read right
|
||||
* after the overflow measure, so layout is already clean.
|
||||
*/
|
||||
_tabClustersWrapInside(container) {
|
||||
for (const box of container.querySelectorAll(':scope > .tab-cluster')) {
|
||||
const tabs = box.querySelectorAll(':scope > .session-tab');
|
||||
if (tabs.length > 1 && tabs[tabs.length - 1].offsetTop > tabs[0].offsetTop + 4) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Middle-click closes a tab, mirroring browser tab strips. Session tabs go
|
||||
// through requestCloseSession (the same confirm modal as the x button), web
|
||||
// tabs through closeWebviewTab (same as theirs). Delegated on the container:
|
||||
|
||||
Reference in New Issue
Block a user