节点视觉重构 + 右栏选项折叠 + 撤销按钮/快捷键

- kind 名做成顶边框标牌(legend,边框在文字处断开)
- 去掉「开头」字(仅绿框)、去掉选择标题的项数
- 多出口节点每出口一行严格对齐右侧黄点
- 开头节点改为视口垂直居中(左侧)
- 选择节点右栏选项改为可折叠,点开编辑单个
- 撤销/重做按钮(不可用时灰)+ R自动整理 + Enter加后继
This commit is contained in:
bia
2026-06-08 19:17:38 +08:00
parent 2b66374e90
commit 2fa4c34bb1
5 changed files with 92 additions and 68 deletions

View File

@ -182,11 +182,9 @@
el("button", { class: "mini", onclick: () => { (node.options = node.options || []).push({ text: "新选项", goto: "" }); ctx.onChange(true); } }, ["+选项"]),
]));
(node.options || []).forEach((o, i) => {
const ob = el("div", { class: "subbox" });
ob.appendChild(el("div", { class: "hd" }, [
el("span", {}, ["选项 " + (i + 1)]),
el("button", { class: "mini", onclick: () => { node.options.splice(i, 1); ctx.onChange(true); } }, ["删"]),
]));
const det = el("details", { class: "optdet" });
det.appendChild(el("summary", {}, ["选项 " + (i + 1) + "" + (o.text || "(空)")]));
const ob = el("div", { class: "optbody" });
ob.appendChild(field("文本", txt(o.text, v => { o.text = v; ctx.onChange(false); })));
ob.appendChild(field("跳转 goto", sel(o.goto, tgt, v => { o.goto = v; ctx.onChange(true); })));
ob.appendChild(condEditor(ir, ctx, o.condition, (c, valOnly) => { if (c) o.condition = c; else delete o.condition; ctx.onChange(!valOnly); }));
@ -202,7 +200,9 @@
skBox.appendChild(grantsEditor(ir, ctx, (o.skip.reward || {}).grants, (gr, valOnly) => { o.skip.reward = { grants: gr }; ctx.onChange(!valOnly); }));
}
ob.appendChild(skBox);
box.appendChild(ob);
ob.appendChild(el("div", { class: "fld" }, [el("button", { class: "mini", onclick: () => { node.options.splice(i, 1); ctx.onChange(true); } }, ["删除此选项"])]));
det.appendChild(ob);
box.appendChild(det);
});
host.appendChild(box);
} else if (node.kind === "random") {