From f2ebbbd87a6fd2d1fc29c681575fa511c716dd29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=93=E9=9B=A8=E9=B9=8F?= <846149189@qq.com> Date: Tue, 9 Jun 2026 10:58:31 +0800 Subject: [PATCH] =?UTF-8?q?feat(graph):=20=E6=88=98=E6=96=97=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E6=98=BE=E7=A4=BA=E6=88=98=E6=96=97=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?=EF=BC=88=E7=B1=BB=E5=9E=8B+=E6=95=8C=E6=88=91=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 战斗节点原本只显示胜/败两个出口、看不出打谁。现在在胜/败行上方加一行 '击倒/死斗 · [我方 vs] 敌方角色名'。描述使内容变高,故 .kind-fight .outputs 用 align-self:stretch + justify-content:flex-end 把胜/败两个黄点压到底部两行, 维持端口与出口行逐行对齐。 --- web/static/graph.js | 13 +++++++++++-- web/static/style.css | 4 ++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/web/static/graph.js b/web/static/graph.js index ef69fa4..96db943 100644 --- a/web/static/graph.js +++ b/web/static/graph.js @@ -71,9 +71,18 @@ return label + '
' + esc(node.summary || "") + '
' + esc(g) + '
'; } const outs = getOutlets(node); - // 多出口(选择/随机/战斗):每出口一行(右对齐),是唯一流内容 → 垂直居中 → 与居中的黄点逐行平齐 + // 多出口(选择/随机/战斗):每出口一行(右对齐)。战斗节点额外在出口行上方加一行战斗描述, + // 出口黄点靠 .kind-fight .outputs{justify-content:flex-end} 压到底部两行(胜/败)保持逐行平齐。 if (outs.length > 1) { - return label + '
' + outs.map(o => '
' + esc(o.label) + '
').join("") + '
'; + let desc = ""; + if (!end && node.kind === "fight") { + const ft = node.fight_type === 2 ? "死斗" : "击倒"; + const foes = (node.camp2 || []).map(s => nameOf(ir, names, s)).join("、") || "未设敌方"; + const allies = (node.camp1 || []).map(s => nameOf(ir, names, s)).join("、"); + const full = ft + " · " + (allies ? (allies + " vs ") : "vs ") + foes; + desc = '
' + esc(full) + '
'; + } + return label + desc + '
' + outs.map(o => '
' + esc(o.label) + '
').join("") + '
'; } // 线性 / 单出口:角色(可选)+ 文本 const sm = summary(ir, names, node); diff --git a/web/static/style.css b/web/static/style.css index 4973415..3d935b8 100644 --- a/web/static/style.css +++ b/web/static/style.css @@ -130,6 +130,10 @@ button.mini { padding:2px 8px; font-size:12px; } .ch-opts { position:relative; top:2px; } .ch-opt { height:25px; line-height:25px; text-align:right; font-size:12px; color:#dfe7f2; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; padding-right:3px; } +/* 战斗节点:出口行(胜/败)上方加一行战斗描述;描述使内容变高,故让两个出口黄点贴底部两行 */ +.drawflow-node .fdesc { font-size:11.5px; color:#e6b8a0; text-align:center; margin-bottom:4px; + overflow:hidden; text-overflow:ellipsis; white-space:nowrap; } +#drawflow .kind-fight .outputs { align-self:stretch; justify-content:flex-end; } /* ---- toast ---- */ #toast { position:fixed; left:50%; bottom:38px; transform:translateX(-50%) translateY(10px);