|
|
@@ -352,8 +352,8 @@ const FlowChartComponent: ForwardRefRenderFunction<FlowChartRef, FlowChartProps>
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
}
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
if (timelineNodes.length > 0) {
|
|
|
@@ -470,27 +470,27 @@ const FlowChartComponent: ForwardRefRenderFunction<FlowChartRef, FlowChartProps>
|
|
|
placeGoalsBottomUp(displayGoals, -1);
|
|
|
|
|
|
timelineNodes.forEach((node) => {
|
|
|
- if (node.type === "message") {
|
|
|
- const textStr = Array.isArray((node.data as any).content) ? (node.data as any).content.map((c: any) => c.text || "").join("") : (((node.data as any).content as any)?.text || "");
|
|
|
- const isCompression = textStr.includes("摘要") || textStr.includes("压缩");
|
|
|
- if (isCompression) {
|
|
|
- const goalId = (node.data as any)._injectedGoalId || (node.data as any).goal_id;
|
|
|
- if (goalId) {
|
|
|
- const goalNode = allGoalNodes.find(g => g.id === goalId);
|
|
|
- if (goalNode) {
|
|
|
- edges.push({
|
|
|
- id: `comp-link-${node.id}`,
|
|
|
- source: node,
|
|
|
- target: goalNode,
|
|
|
- type: "compression_link",
|
|
|
- level: 0,
|
|
|
- collapsible: false,
|
|
|
- collapsed: false,
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
+ if (node.type === "message") {
|
|
|
+ const textStr = Array.isArray((node.data as any).content) ? (node.data as any).content.map((c: any) => c.text || "").join("") : (((node.data as any).content as any)?.text || "");
|
|
|
+ const isCompression = textStr.includes("摘要") || textStr.includes("压缩");
|
|
|
+ if (isCompression) {
|
|
|
+ const goalId = (node.data as any)._injectedGoalId || (node.data as any).goal_id;
|
|
|
+ if (goalId) {
|
|
|
+ const goalNode = allGoalNodes.find(g => g.id === goalId);
|
|
|
+ if (goalNode) {
|
|
|
+ edges.push({
|
|
|
+ id: `comp-link-${node.id}`,
|
|
|
+ source: node,
|
|
|
+ target: goalNode,
|
|
|
+ type: "compression_link",
|
|
|
+ level: 0,
|
|
|
+ collapsible: false,
|
|
|
+ collapsed: false,
|
|
|
+ });
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
// Compute Sibling Connections
|
|
|
@@ -898,32 +898,32 @@ const FlowChartComponent: ForwardRefRenderFunction<FlowChartRef, FlowChartProps>
|
|
|
const arcPath = `M ${sx},${sy} C ${sx - bulge},${sy} ${tx - bulge},${ty} ${tx},${ty}`;
|
|
|
|
|
|
return (
|
|
|
- <g
|
|
|
- key={edge.id}
|
|
|
- onMouseEnter={(e) => {
|
|
|
- if (hoveredArcId !== edge.id) {
|
|
|
- setHoveredArcId(edge.id);
|
|
|
- const svg = e.currentTarget.closest("svg");
|
|
|
- const ctm = (e.currentTarget as SVGGElement).getScreenCTM();
|
|
|
- if (svg && ctm) {
|
|
|
- const point = svg.createSVGPoint();
|
|
|
- point.x = e.clientX;
|
|
|
- point.y = e.clientY;
|
|
|
- const localPoint = point.matrixTransform(ctm.inverse());
|
|
|
- setHoverPos({ x: localPoint.x, y: localPoint.y });
|
|
|
- }
|
|
|
- }
|
|
|
- }}
|
|
|
- onMouseLeave={() => {
|
|
|
- setHoveredArcId(null);
|
|
|
- setHoverPos(null);
|
|
|
- }}
|
|
|
- style={{ cursor: "pointer" }}
|
|
|
+ <g
|
|
|
+ key={edge.id}
|
|
|
+ onMouseEnter={(e) => {
|
|
|
+ if (hoveredArcId !== edge.id) {
|
|
|
+ setHoveredArcId(edge.id);
|
|
|
+ const svg = e.currentTarget.closest("svg");
|
|
|
+ const ctm = (e.currentTarget as SVGGElement).getScreenCTM();
|
|
|
+ if (svg && ctm) {
|
|
|
+ const point = svg.createSVGPoint();
|
|
|
+ point.x = e.clientX;
|
|
|
+ point.y = e.clientY;
|
|
|
+ const localPoint = point.matrixTransform(ctm.inverse());
|
|
|
+ setHoverPos({ x: localPoint.x, y: localPoint.y });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ onMouseLeave={() => {
|
|
|
+ setHoveredArcId(null);
|
|
|
+ setHoverPos(null);
|
|
|
+ }}
|
|
|
+ style={{ cursor: "pointer" }}
|
|
|
>
|
|
|
<path
|
|
|
d={arcPath}
|
|
|
fill="none"
|
|
|
- stroke="#8b5cf6"
|
|
|
+ stroke="#94a3b8"
|
|
|
strokeWidth={hoveredArcId === edge.id ? 4 : 3}
|
|
|
strokeDasharray={hoveredArcId === edge.id ? undefined : "5,5"}
|
|
|
markerEnd="url(#arrow-default)"
|
|
|
@@ -939,10 +939,10 @@ const FlowChartComponent: ForwardRefRenderFunction<FlowChartRef, FlowChartProps>
|
|
|
/>
|
|
|
{hoveredArcId === edge.id && hoverPos && (
|
|
|
<g transform={`translate(${hoverPos.x - 14}, ${hoverPos.y + 5})`}>
|
|
|
- <rect width={70} height={24} fill="#8b5cf6" rx={4} onClick={(e) => jumpToNode(edge.source.id, e)} />
|
|
|
+ <rect width={70} height={24} fill="#94a3b8" rx={4} onClick={(e) => jumpToNode(edge.source.id, e)} />
|
|
|
<text x={35} y={16} fill="white" textAnchor="middle" style={{ fontSize: 12, pointerEvents: "none" }}>向上跳转</text>
|
|
|
|
|
|
- <rect y={30} width={70} height={24} fill="#8b5cf6" rx={4} onClick={(e) => jumpToNode(edge.target.id, e)} />
|
|
|
+ <rect y={30} width={70} height={24} fill="#94a3b8" rx={4} onClick={(e) => jumpToNode(edge.target.id, e)} />
|
|
|
<text x={35} y={46} fill="white" textAnchor="middle" style={{ fontSize: 12, pointerEvents: "none" }}>向下跳转</text>
|
|
|
</g>
|
|
|
)}
|
|
|
@@ -1159,7 +1159,7 @@ const FlowChartComponent: ForwardRefRenderFunction<FlowChartRef, FlowChartProps>
|
|
|
{hasRemoteParent && node.type === "message" && (
|
|
|
<rect
|
|
|
x={-73} y={-28} width={146} height={56} rx={10}
|
|
|
- fill="none" stroke="#a855f7" strokeWidth={2} strokeDasharray="4,2"
|
|
|
+ fill="none" stroke="#94a3b8" strokeWidth={2} strokeDasharray="4,2"
|
|
|
style={{ pointerEvents: "none" }}
|
|
|
/>
|
|
|
)}
|