diff --git a/app/src/constants.ts b/app/src/constants.ts index 04d0d448e..ecf4cc517 100644 --- a/app/src/constants.ts +++ b/app/src/constants.ts @@ -75,6 +75,7 @@ export abstract class Constants { public static readonly TIMEOUT_SEARCH = 300; public static readonly TIMEOUT_INPUT = 256; public static readonly TIMEOUT_BLOCKLOAD = 300; + public static readonly TIMEOUT_TRANSITION = 150; // help path public static readonly HELP_PATH = { diff --git a/app/src/layout/Tab.ts b/app/src/layout/Tab.ts index 00e9403ba..04af60fe5 100644 --- a/app/src/layout/Tab.ts +++ b/app/src/layout/Tab.ts @@ -30,6 +30,7 @@ export class Tab { this.headElement = document.createElement("li"); this.headElement.setAttribute("data-type", "tab-header"); this.headElement.setAttribute("draggable", "true"); + this.headElement.setAttribute("style", "flex: 0;width: 0;overflow: hidden"); this.headElement.setAttribute("data-id", this.id); this.headElement.setAttribute("data-position", "center"); // showTooltip 位置标识 this.headElement.classList.add("item", "item--focus"); diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts index 6438b4919..9a494117f 100644 --- a/app/src/layout/Wnd.ts +++ b/app/src/layout/Wnd.ts @@ -443,6 +443,10 @@ export class Wnd { this.headersElement.children[oldFocusIndex].after(tab.headElement); } + setTimeout(() => { + tab.headElement.removeAttribute("style") + }, Constants.TIMEOUT_TRANSITION); + tab.headElement.querySelector(".item__close").addEventListener("click", (event) => { if (tab.headElement.classList.contains("item--pin")) { tab.unpin(); @@ -611,7 +615,10 @@ export class Wnd { this.switchTab(this.children[currentIndex].headElement, true); } } - item.headElement.remove(); + item.headElement.setAttribute("style", "flex: 0;width: 0;overflow: hidden"); + setTimeout(() => { + item.headElement.remove(); + }, Constants.TIMEOUT_TRANSITION); } item.panelElement.remove(); this.destroyModel(item.model);