feat: lay out PARALLEL branches as vertical columns

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
0264408
2026-09-20 10:07:26 +08:00
co-authored by Cursor
parent 18b62003d1
commit 43b4a83407
5 changed files with 76 additions and 57 deletions
+7 -6
View File
@@ -252,8 +252,9 @@ export const useDesignerStore = defineStore('designer', () => {
publishedVersion.value = params.version ?? null
loadedFromDraft.value = Boolean(params.fromDraft)
const expanded = expandLegacyParallel(params.nodes, params.edges)
nodes.value = fitParallelFrames(expanded.nodes)
edges.value = assignEdgeHandles(expanded.nodes, expanded.edges)
const parallels = expanded.nodes.filter((node) => node.data?.kind === 'PARALLEL').map((node) => node.id)
nodes.value = parallels.reduce((current, id) => reflowLanes(current, id), expanded.nodes)
edges.value = assignEdgeHandles(nodes.value, expanded.edges)
syncStartFlags()
clearSelection()
resetHistory()
@@ -707,10 +708,10 @@ export const useDesignerStore = defineStore('designer', () => {
pushHistory()
const laneIndex = parent.data.lanes.indexOf(lane)
const stepIndex = nodes.value.filter((node) => node.parentNode === parallelId && laneOf(node.data) === lane).length
nodes.value = fitParallelFrames([
...nodes.value,
spawnLaneStep(parallelId, lane, laneIndex, stepIndex, nextId(lane), kind),
])
nodes.value = reflowLanes(
[...nodes.value, spawnLaneStep(parallelId, lane, laneIndex, stepIndex, nextId(lane), kind)],
parallelId,
)
}
function renameLane(parallelId: string, from: string, to: string): boolean {