From ed1b1777b501e565417066773c9be8d6fd2fa0fd Mon Sep 17 00:00:00 2001 From: RoyirinRosmontis Date: Thu, 20 Aug 2026 12:14:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=81=8C=E7=BA=A7/=E6=97=B6?= =?UTF-8?q?=E5=BA=8F=E8=A7=86=E5=9B=BE=E6=8C=A4=E5=8E=8B=EF=BC=9A=E5=B2=97?= =?UTF-8?q?=E4=BD=8D=E5=B8=A6=E5=86=85=E5=A4=9A=E8=A1=8C=E6=8E=92=E5=88=97?= =?UTF-8?q?=EF=BC=8C=E6=97=B6=E5=BA=8F=E8=A7=86=E5=9B=BE=E5=9F=BA=E4=BA=8E?= =?UTF-8?q?=E5=85=A8=E6=99=AF=E5=8A=9B=E5=AF=BC=E5=90=91=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E5=8F=96=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webui/graph.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/webui/graph.js b/webui/graph.js index c7bee24..ef80fff 100644 --- a/webui/graph.js +++ b/webui/graph.js @@ -153,9 +153,11 @@ const yBand = LEVEL_BANDS[b].y; const jl = G.nodes.filter((n) => n.type === "Job" && levelBandOf(n) === b) .sort((x, y) => String(x.title || x.id).localeCompare(String(y.title || y.id), "zh")); + // 岗位带内多行排列(一行排开会横向过长,fitView 按比例缩成横带) + const jPerRow = Math.max(3, Math.ceil(Math.sqrt(jl.length) * 1.8)); jl.forEach((n, i) => { - n.x = (i - (jl.length - 1) / 2) * 200; - n.y = yBand + 170; + n.x = ((i % jPerRow) - (jPerRow - 1) / 2) * 190; + n.y = yBand + 150 - Math.floor(i / jPerRow) * 85; n.vx = 0; n.vy = 0; }); const sl = G.nodes.filter((n) => n.type !== "Job" && levelBandOf(n) === b) @@ -218,7 +220,12 @@ G.activeNodes = null; G.activeEdges = null; } else if (mode === "tech") applyTechLayout(); else if (mode === "level") applyLevelLayout(); - else if (mode === "timeline") setupTimeline(); + else if (mode === "timeline") { + // 时序视图沿用全景力导向布局(否则继承上一个视图的特化布局会被压扁) + if (G._overviewPos) G._overviewPos.forEach((p, i) => { G.nodes[i].x = p.x; G.nodes[i].y = p.y; G.nodes[i].vx = 0; G.nodes[i].vy = 0; }); + else layout(); + setupTimeline(); + } if (G.soloJob) { applySoloLayout(); fitSoloView(); } else fitView(); requestDraw(); drawMinimap(); @@ -229,7 +236,11 @@ function relayoutByView() { if (G.viewMode === "tech") applyTechLayout(); else if (G.viewMode === "level") applyLevelLayout(); - else if (G.viewMode === "timeline") setupTimeline(); + else if (G.viewMode === "timeline") { + if (G._overviewPos) G._overviewPos.forEach((p, i) => { G.nodes[i].x = p.x; G.nodes[i].y = p.y; G.nodes[i].vx = 0; G.nodes[i].vy = 0; }); + else layout(); + setupTimeline(); + } } /* ================= 数据装载 ================= */