Фикс стрелок

This commit is contained in:
NikitaKalitov
2026-07-20 13:07:57 +03:00
parent da7e022f50
commit 6e880963ab
2 changed files with 27 additions and 13 deletions
+19 -12
View File
@@ -129,18 +129,25 @@ function toRfNodes(doc: DiagramDocument | null): Node[] {
}
function toRfEdges(doc: DiagramDocument | null): Edge[] {
return (doc?.edges ?? []).map((edge) => ({
id: edge.id,
source: edge.source,
target: edge.target,
sourceHandle: edge.sourceHandle,
targetHandle: edge.targetHandle,
type: edge.type ?? DEFAULT_EDGE_TYPE,
markerEnd: DEFAULT_MARKER_END,
label: edge.label,
zIndex: edge.zIndex,
data: edge.data,
}));
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,
sourceHandle: edge.sourceHandle,
targetHandle: edge.targetHandle,
type: edge.type ?? DEFAULT_EDGE_TYPE,
markerEnd: DEFAULT_MARKER_END,
label: edge.label,
zIndex: edge.zIndex,
data: edge.data,
}));
}
function isEditableTarget(target: EventTarget | null): boolean {
+8 -1
View File
@@ -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;
}
/*