From e4c0d820f4938431dc633048da631de3b925a6f1 Mon Sep 17 00:00:00 2001 From: Pouzor Date: Sun, 29 Mar 2026 15:18:19 +0200 Subject: [PATCH] fix: render snake vs flow edge animations correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit edges/index.tsx was never committed — both animation modes were rendering as snake (truthy string check). Now uses animMode to distinguish 'snake' (moving blob) from 'flow' (continuous flowing dashes). --- .../src/components/canvas/edges/index.tsx | 46 +++++++++++-------- frontend/src/utils/canvasSerializer.ts | 2 +- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/frontend/src/components/canvas/edges/index.tsx b/frontend/src/components/canvas/edges/index.tsx index c56f23f..6072b91 100644 --- a/frontend/src/components/canvas/edges/index.tsx +++ b/frontend/src/components/canvas/edges/index.tsx @@ -50,42 +50,48 @@ export function HomelableEdge({ id, source, target, sourceX, sourceY, targetX, t ...(selected ? { stroke: theme.colors.edgeSelectedColor, filter: `drop-shadow(0 0 4px ${theme.colors.edgeSelectedColor}88)` } : {}), } - // Animated dot: slightly brighter + thicker than the base edge, travels source→target - const dotColor = customColor ?? (edgeType === 'vlan' ? getVlanColor(data?.vlan_id as number | undefined) : edgeColors[edgeType as keyof typeof edgeColors] as string) - const dotWidth = ((style.strokeWidth as number ?? 2) + 1.5) * 2 + // Normalize animated value — supports legacy boolean (true → 'snake') + const animMode: 'none' | 'snake' | 'flow' = + data?.animated === true || data?.animated === 'snake' ? 'snake' : + data?.animated === 'flow' ? 'flow' : 'none' + + const animColor = customColor ?? (edgeType === 'vlan' ? getVlanColor(data?.vlan_id as number | undefined) : edgeColors[edgeType as keyof typeof edgeColors] as string) return ( <> - {data?.animated && ( + {animMode === 'snake' && ( {isBidirectional ? ( - + ) : ( - + )} )} + {animMode === 'flow' && ( + + + + )} + {data?.label && (