diff --git a/packages/khbuild_process_viz/src/gantt.ts b/packages/khbuild_process_viz/src/gantt.ts index e75c5c8..0c38b75 100644 --- a/packages/khbuild_process_viz/src/gantt.ts +++ b/packages/khbuild_process_viz/src/gantt.ts @@ -273,6 +273,8 @@ export function renderGantt(model: ProcessModel, schedule: Schedule, opts: Gantt }; if (opts.deps !== false) { const arrows: string[] = []; + const ghostLines: string[] = []; + const ghostMarks: string[] = []; const redundant = redundantDependencies(model.rows); for (const g of groups) { for (const { row } of g.rows) { @@ -290,10 +292,12 @@ export function renderGantt(model: ProcessModel, schedule: Schedule, opts: Gantt const gc = color(groupOf.get(dep)!.stage).stroke; const gy = to.y; const ghost = ``; - const gl = `${esc(truncate(`${dep} ${depRow.actionName ?? ""}`, 40))}`; - const lp = x2 > x1 + 7 ? `M${x1 + 7} ${gy} H${x2}` : x2 < x1 - 7 ? `M${x1 - 7} ${gy} H${x2}` : ""; // назад - если шаг начинается раньше вехи (противоречие) - const line = lp ? `` : ""; - arrows.push(`${tooltip([label])}${ghost}${gl}${line}`); + const several = row.dependsOn.filter((d) => model.rows.find((r) => r.id === d)?.isMilestone && !redundant.has(`${d}>${row.id}`)).length > 1; + const gl = `${esc(several ? dep : truncate(`${dep} ${depRow.actionName ?? ""}`, 40))}`; // несколько вех на одной строке: только id, чтобы подписи не налезали + const x2e = row.isMilestone ? x2 - 10 : x2; // у вехи-цели стрелка заканчивается перед ромбом, иначе остриё закрыто ромбом + const lp = x2e > x1 + 7 ? `M${x1 + 7} ${gy} H${x2e}` : x2e < x1 - 7 ? `M${x1 - 7} ${gy} H${x2e}` : ""; // назад - если шаг начинается раньше вехи (противоречие) + if (lp) ghostLines.push(`${tooltip([label])}`); + ghostMarks.push(`${tooltip([label])}${ghost}${gl}`); continue; } const d = x2 >= x1 ? `M${x1} ${from.y} V${to.y} H${x2}` : `M${x1} ${from.y} H${x1 + 6} V${to.y} H${x2}`; @@ -301,7 +305,9 @@ export function renderGantt(model: ProcessModel, schedule: Schedule, opts: Gantt } } } - out.push(`${arrows.join("")}`); + // слои снизу вверх: линии от контурных вех (почти фон), обычные зависимости, контурные ромбы с подписями (поверх линий) + out.push(`${ghostLines.join("")}${arrows.join("")}`); + out.push(`${ghostMarks.join("")}`); } // Строки раскрытых групп @@ -439,6 +445,6 @@ export function renderGantt(model: ProcessModel, schedule: Schedule, opts: Gantt `крайний срок`, ); - const defs = ``; + const defs = ``; return svgDoc(width, height, defs, out.join("\n"), `data-left="${GANTT_LEFT}" data-px="${px}"`); }