职级视图再修:技能节点补词表 level 分带(此前全部落中级带),带间距拉大、技能/岗位分行限排,宽高比 5.2→2.4

This commit is contained in:
RoyirinRosmontis
2026-08-20 12:25:13 +08:00
parent ed1b1777b5
commit beccaa4b6b
2 changed files with 16 additions and 9 deletions
+8 -8
View File
@@ -99,9 +99,9 @@
/* ================= 视图切换:全景 / 技术栈 / 职级演进 / 动态时序 ================= */
const VIEW_NAMES = { overview: "全景总览", tech: "技术栈视图", level: "职级演进视图", timeline: "动态时序视图" };
const LEVEL_BANDS = [
{ name: "初级 L1 · ≤2 年", y: -340 },
{ name: "初级 L1 · ≤2 年", y: -420 },
{ name: "中级 L2 · 3-5 年", y: 0 },
{ name: "高级 L3 · >5 年", y: 340 },
{ name: "高级 L3 · >5 年", y: 420 },
];
/* 技术栈视图:类别锚点网格分布,岗位聚在锚点旁,技能/场景/行业靠向所属岗位质心 */
@@ -153,19 +153,19 @@
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));
// 岗位在带线下方(最多 2 行),技能在带线上方(最多 3 行),两者不重叠
const jPerRow = Math.max(3, Math.ceil(jl.length / 2));
jl.forEach((n, i) => {
n.x = ((i % jPerRow) - (jPerRow - 1) / 2) * 190;
n.y = yBand + 150 - Math.floor(i / jPerRow) * 85;
n.y = yBand + 90 + Math.floor(i / jPerRow) * 85;
n.vx = 0; n.vy = 0;
});
const sl = 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"));
const perRow = Math.max(4, Math.ceil(Math.sqrt(sl.length) * 1.9));
const perRow = Math.max(4, Math.ceil(sl.length / 4));
sl.forEach((n, i) => {
n.x = ((i % perRow) - (perRow - 1) / 2) * 108;
n.y = yBand - 120 + Math.floor(i / perRow) * 72;
n.x = ((i % perRow) - (perRow - 1) / 2) * 100;
n.y = yBand - 170 + Math.floor(i / perRow) * 62;
n.vx = 0; n.vy = 0;
});
});