fix(editor): retain wire selection for endpoints

This commit is contained in:
Lucio Lelii 2026-09-30 09:17:58 +02:00
parent bcc9009278
commit 4e0d234763
1 changed files with 9 additions and 3 deletions

View File

@ -225,9 +225,15 @@ export async function createEditor(
});
area.addPipe((context: any) => {
// The connection renderer raises only the selected wire. A picked node is about to be dragged,
// so clear that selection before its card can be drawn below the wire.
if (context?.type === 'nodepicked') graphSelection.clearConnectionSelection();
// The connection renderer raises only the selected wire. Clear it before dragging an unrelated
// card, but keep it when the picked card is one of the wire's own endpoints.
if (context?.type === 'nodepicked') {
const selected = graphSelection.selectedConnection();
const nodeId = String(context.data?.id ?? '');
if (!selected || (nodeId !== selected.sourceId && nodeId !== selected.targetId)) {
graphSelection.clearConnectionSelection();
}
}
if (context?.type === 'nodetranslated') {
// A loop follows only its own endpoints. A card merely crossed by the wire must not make the
// wire move away, while moving either endpoint keeps the wire 48px above that endpoint.