Легенда связи смещена выше stroke; убран extent parent, чтобы узлы можно было вынести из группы. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -59,11 +59,12 @@ function TopologyEdgeComponent(props: EdgeProps<Edge<TopologyEdgeData>>) {
|
|||||||
<EdgeLabelRenderer>
|
<EdgeLabelRenderer>
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
'nodrag nopan absolute flex max-w-[220px] flex-wrap items-center justify-center gap-1 rounded-md border border-border bg-background/95 px-1.5 py-1 shadow-sm backdrop-blur-sm',
|
'nodrag nopan absolute z-[1000] flex max-w-[220px] flex-wrap items-center justify-center gap-1 rounded-md border border-border bg-background px-1.5 py-1 shadow-sm',
|
||||||
selected && 'ring-1 ring-primary/40',
|
selected && 'ring-1 ring-primary/40',
|
||||||
)}
|
)}
|
||||||
style={{
|
style={{
|
||||||
transform: `translate(-50%, -50%) translate(${labelX}px,${labelY}px)`,
|
// Смещение вверх от центра линии, чтобы легенда была над stroke
|
||||||
|
transform: `translate(-50%, -100%) translate(${labelX}px,${labelY - 6}px)`,
|
||||||
pointerEvents: 'all',
|
pointerEvents: 'all',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -14,10 +14,12 @@ export function normalizeGroupLayers(nodes: TopologyFlowNode[]): TopologyFlowNod
|
|||||||
if (n.type === 'group') {
|
if (n.type === 'group') {
|
||||||
return { ...n, zIndex: n.selected ? 0 : GROUP_Z }
|
return { ...n, zIndex: n.selected ? 0 : GROUP_Z }
|
||||||
}
|
}
|
||||||
if (n.zIndex != null && n.zIndex < CONTENT_Z) {
|
// extent: 'parent' блокирует вытаскивание — не используем; parentId достаточно для «прилипания»
|
||||||
return { ...n, zIndex: CONTENT_Z }
|
const cleared = n.extent != null ? { ...n, extent: undefined } : n
|
||||||
|
if (cleared.zIndex != null && cleared.zIndex < CONTENT_Z) {
|
||||||
|
return { ...cleared, zIndex: CONTENT_Z }
|
||||||
}
|
}
|
||||||
return n.zIndex == null ? { ...n, zIndex: CONTENT_Z } : n
|
return cleared.zIndex == null ? { ...cleared, zIndex: CONTENT_Z } : cleared
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,7 +124,7 @@ export function attachNodeToGroup(
|
|||||||
return {
|
return {
|
||||||
...node,
|
...node,
|
||||||
parentId: group.id,
|
parentId: group.id,
|
||||||
extent: 'parent',
|
extent: undefined,
|
||||||
zIndex: CONTENT_Z,
|
zIndex: CONTENT_Z,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -132,7 +134,7 @@ export function attachNodeToGroup(
|
|||||||
return {
|
return {
|
||||||
...node,
|
...node,
|
||||||
parentId: group.id,
|
parentId: group.id,
|
||||||
extent: 'parent',
|
extent: undefined,
|
||||||
position: {
|
position: {
|
||||||
x: abs.x - groupAbs.x,
|
x: abs.x - groupAbs.x,
|
||||||
y: abs.y - groupAbs.y,
|
y: abs.y - groupAbs.y,
|
||||||
@@ -201,7 +203,7 @@ export function placeWithOptionalParent(
|
|||||||
return {
|
return {
|
||||||
...node,
|
...node,
|
||||||
parentId: group.id,
|
parentId: group.id,
|
||||||
extent: 'parent',
|
extent: undefined,
|
||||||
position: {
|
position: {
|
||||||
x: flowPosition.x - groupAbs.x,
|
x: flowPosition.x - groupAbs.x,
|
||||||
y: flowPosition.y - groupAbs.y,
|
y: flowPosition.y - groupAbs.y,
|
||||||
|
|||||||
Reference in New Issue
Block a user