Skip to content
This repository was archived by the owner on May 9, 2021. It is now read-only.
/ liandi Public archive

Commit a574934

Browse files
committed
🚨
1 parent bb0b7cf commit a574934

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

app/src/layout/Wnd.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ export class Wnd {
314314
this.resetLayout(layout);
315315
}
316316

317-
private resetLayout(layout: Layout) {
317+
public resetLayout(layout: Layout) {
318318
if (layout.type === "center" || layout.type === "normal" || layout.children.length !== 1) {
319319
return;
320320
}
@@ -324,14 +324,17 @@ export class Wnd {
324324
window.liandi.centerLayout.element.style.width = (window.liandi.centerLayout.element.clientWidth - 200) + "px";
325325
layout.element.style.width = "206px";
326326
} else if (layout.type === "right" && layout.element.clientWidth < 7) {
327-
window.liandi.centerLayout.element.style.width = (window.liandi.centerLayout.element.clientWidth - window.innerWidth / 3) + "px";
327+
const rightWidth = window.innerWidth / 3
328+
window.liandi.centerLayout.element.style.width = (window.liandi.centerLayout.element.clientWidth - rightWidth) + "px";
329+
window.liandi.rightLayoutWidth = rightWidth
328330
} else if (layout.type === "top" && layout.element.clientHeight < 7) {
329331
window.liandi.centerLayout.parent.element.style.height = (window.liandi.centerLayout.parent.element.clientHeight - 200) + "px";
330332
layout.element.style.height = "206px";
331333
} else if (layout.type === "bottom" &&
332334
(layout.element.clientHeight + window.liandi.centerLayout.parent.element.clientHeight + window.liandi.topLayout.element.clientHeight > window.innerHeight
333335
|| layout.element.clientHeight < 7)) {
334336
window.liandi.centerLayout.parent.element.style.height = (window.liandi.centerLayout.parent.element.clientHeight - 200) + "px";
337+
window.liandi.bottomLayoutHeight = 200
335338
}
336339
} else if (layout.children[0].children.length === 1) {
337340
if (layout.type === "left" || layout.type === "right") {

app/src/websocket/onGetConfig.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,8 @@ const initBar = () => {
5353
const tab = new Tab({
5454
title: `<svg class="item__svg"><use xlink:href="#iconFiles"></use></svg> ${i18n[window.liandi.config.lang].fileTree}`,
5555
callback(tab: Tab) {
56-
if (window.liandi.leftLayout.element.clientWidth < 7) {
57-
window.liandi.centerLayout.element.style.width = (window.liandi.centerLayout.element.clientWidth - 200) + "px";
58-
window.liandi.leftLayout.element.style.width = "206px";
59-
}
6056
tab.addModel(new Files(tab));
57+
(window.liandi.leftLayout.children[0] as Wnd).resetLayout(window.liandi.leftLayout)
6158
}
6259
});
6360
(window.liandi.leftLayout.children[0] as Wnd).addTab(tab);
@@ -68,10 +65,8 @@ const initBar = () => {
6865
title: `<svg class="item__svg"><use xlink:href="#iconGraph"></use></svg> ${i18n[window.liandi.config.lang].graphView}`,
6966
panel: '<div class="graph__input"><input class="input"></div><div class="fn__flex-1"></div>',
7067
callback(tab: Tab) {
71-
if (window.liandi.rightLayout.element.clientWidth < 7) {
72-
window.liandi.centerLayout.element.style.width = (window.liandi.centerLayout.element.clientWidth - window.innerWidth / 3) + "px";
73-
}
7468
tab.addModel(new Graph({tab}));
69+
(window.liandi.rightLayout.children[0] as Wnd).resetLayout(window.liandi.rightLayout)
7570
}
7671
});
7772
(window.liandi.rightLayout.children[0] as Wnd).addTab(tab);

0 commit comments

Comments
 (0)