关闭关系图时进行销毁

This commit is contained in:
Vanessa 2024-11-04 12:04:27 +08:00
parent c7343e56cd
commit 38ad9eff13
2 changed files with 15 additions and 3 deletions

View file

@ -505,6 +505,10 @@ export class Graph extends Model {
this.network.selectNodes([id]);
}
public destroy() {
this.network?.destroy();
}
public onGraph(hl: boolean) {
if (this.graphElement.clientHeight === 0) {
// 界面没有渲染时不能进行渲染

View file

@ -534,8 +534,12 @@ export class Dock {
clearTimeout(this.hideResizeTimeout);
this.hideDock();
}
if ((type === "graph" || type === "globalGraph") && this.layout.element.querySelector(".fullscreen")) {
document.getElementById("drag")?.classList.remove("fn__hidden");
if ((type === "graph" || type === "globalGraph")) {
if (this.layout.element.querySelector(".fullscreen")) {
document.getElementById("drag")?.classList.remove("fn__hidden");
}
const graph = this.data[type] as Graph
graph.destroy();
}
// 关闭 dock 后设置光标,初始化的时候不能设置,否则关闭文档树且多页签时会请求两次 getDoc
if (isSaveLayout && !document.querySelector(".layout__center .layout__wnd--active")) {
@ -752,6 +756,10 @@ export class Dock {
}
resizeTabs(isSaveLayout);
this.showDock();
if (target.classList.contains("dock__item--active") && !hide && (type === "graph" || type === "globalGraph")) {
const graph = this.data[type] as Graph
graph.onGraph(false);
}
}
public add(index: number, sourceElement: Element, previousType?: string) {
@ -794,7 +802,7 @@ export class Dock {
saveLayout();
}
public remove(key: TDock|string) {
public remove(key: TDock | string) {
this.toggleModel(key, false, true, true);
this.element.querySelector(`[data-type="${key}"]`).remove();
const custom = this.data[key] as Custom;