diff --git a/frontend/src/GraphView.jsx b/frontend/src/GraphView.jsx index 1243e67..48175af 100644 --- a/frontend/src/GraphView.jsx +++ b/frontend/src/GraphView.jsx @@ -79,8 +79,11 @@ function GraphView({ servers, connections }) { // Контролы масштабирования const zoomBy = (factor) => { + if (!zoomRef.current || !svgRef.current) return; const svg = d3.select(svgRef.current); - svg.transition().duration(200).call(zoomRef.current.scaleBy, factor); + const node = svgRef.current; + const center = [node.clientWidth / 2, node.clientHeight / 2]; + svg.transition().duration(220).call(zoomRef.current.scaleBy, factor, center); }; const fitToView = () => { @@ -263,6 +266,10 @@ function GraphView({ servers, connections }) { + {/* Тень для ярлыков ссылок */} + + + {/* Подложка сетки */} @@ -309,36 +316,57 @@ function GraphView({ servers, connections }) { style={{ vectorEffect: 'non-scaling-stroke' }} /> - {/* Подпись связи */} - - - {connection.tunnelType} - - - {connection.ipA} ⇄ {connection.ipB} - + {/* Подпись связи: ярлык с подложкой и halo */} + {(() => { + const labelW = 140; + const labelH = 38; + const lx = cx - labelW / 2; + const ly = cy - labelH / 2 - 4; // слегка выше вершины + return ( + + + {/* Halo для заголовка */} + + {connection.tunnelType} + + {/* Линия IP с более мелким шрифтом */} + + {connection.ipA} ⇄ {connection.ipB} + + + ); + })()} ); })}