mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
auto hide/show last tab separator
This commit is contained in:
parent
55b4e26cce
commit
4ea5426b57
@ -226,14 +226,23 @@ const Tab = memo(
|
|||||||
separator.style.opacity = "1"; // Reset opacity for the current tab only if not active
|
separator.style.opacity = "1"; // Reset opacity for the current tab only if not active
|
||||||
}
|
}
|
||||||
|
|
||||||
// If dragging tab is the first tab set opacity to 1
|
|
||||||
if (draggingId === tabIds[0]) {
|
|
||||||
const draggingTabElement = document.querySelector(
|
const draggingTabElement = document.querySelector(
|
||||||
`[data-tab-id="${draggingId}"]`
|
`[data-tab-id="${draggingId}"]`
|
||||||
) as HTMLElement;
|
) as HTMLElement;
|
||||||
if (!draggingTabElement) return;
|
if (!draggingTabElement) return;
|
||||||
|
|
||||||
|
// If dragging tab is the first tab set opacity to 1
|
||||||
|
if (draggingId === tabIds[0]) {
|
||||||
const separator = draggingTabElement.querySelector(".separator") as HTMLElement;
|
const separator = draggingTabElement.querySelector(".separator") as HTMLElement;
|
||||||
separator.style.opacity = "1";
|
separator.style.opacity = "1";
|
||||||
|
} else if (draggingId === tabIds[tabIds.length - 1]) {
|
||||||
|
// if daragging tab is the last tab set opacity of right separator to 1
|
||||||
|
const draggingTabElement = document.querySelector(
|
||||||
|
`[data-tab-id="${draggingId}"]`
|
||||||
|
) as HTMLElement;
|
||||||
|
if (!draggingTabElement) return;
|
||||||
|
const separator = draggingTabElement.querySelector(".right-separator") as HTMLElement;
|
||||||
|
separator.style.opacity = "1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,10 +269,14 @@ const Tab = memo(
|
|||||||
const currentTabElement = document.querySelector(`[data-tab-id="${id}"]`) as HTMLElement;
|
const currentTabElement = document.querySelector(`[data-tab-id="${id}"]`) as HTMLElement;
|
||||||
if (!currentTabElement) return;
|
if (!currentTabElement) return;
|
||||||
const separator = currentTabElement.querySelector(".separator") as HTMLElement;
|
const separator = currentTabElement.querySelector(".separator") as HTMLElement;
|
||||||
|
const rightSeparator = currentTabElement.querySelector(".right-separator") as HTMLElement;
|
||||||
|
|
||||||
if (isActive || draggingId === id) {
|
if (isActive || draggingId === id) {
|
||||||
console.log("here!!!!!", currentTabElement, draggingId);
|
console.log("here!!!!!", currentTabElement, draggingId);
|
||||||
separator.style.opacity = "0";
|
separator.style.opacity = "0";
|
||||||
|
if (rightSeparator) {
|
||||||
|
rightSeparator.style.opacity = "0";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the opacity of the separator for the right adjacent tab
|
// Set the opacity of the separator for the right adjacent tab
|
||||||
|
Loading…
Reference in New Issue
Block a user