Фикс стрелок
This commit is contained in:
@@ -129,7 +129,14 @@ function toRfNodes(doc: DiagramDocument | null): Node[] {
|
||||
}
|
||||
|
||||
function toRfEdges(doc: DiagramDocument | null): Edge[] {
|
||||
return (doc?.edges ?? []).map((edge) => ({
|
||||
const nodeIds = new Set((doc?.nodes ?? []).map((node) => node.id));
|
||||
// Defends against documents saved by an older/buggy version, or edited by
|
||||
// hand — an edge pointing at a node id that no longer exists renders as a
|
||||
// degenerate path (xyflow falls back to position (0, 0) for the missing
|
||||
// endpoint), which is exactly the "arrows in the corner" bug.
|
||||
return (doc?.edges ?? [])
|
||||
.filter((edge) => nodeIds.has(edge.source) && nodeIds.has(edge.target))
|
||||
.map((edge) => ({
|
||||
id: edge.id,
|
||||
source: edge.source,
|
||||
target: edge.target,
|
||||
|
||||
+8
-1
@@ -30,8 +30,15 @@
|
||||
background: color-mix(in srgb, canvastext 8%, canvas);
|
||||
}
|
||||
|
||||
/*
|
||||
* opacity/pointer-events, not display:none — hiding via display collapses the
|
||||
* handle to 0x0, and xyflow computes edge paths from the handle's actual
|
||||
* layout position, so every edge that references a handle id would snap to
|
||||
* a degenerate point the moment view mode hid it.
|
||||
*/
|
||||
.diagram-flow--view-mode .react-flow__handle {
|
||||
display: none;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user