|
1 | 1 | <script setup lang="ts"> |
| 2 | +import { AntQuadratic } from '@/utils/g6'; |
2 | 3 | import { getNodeQf, getTrackTreeContext } from '@/utils/node'; |
3 | 4 | import { colorList } from '@/utils/others'; |
4 | 5 | import { transform } from '@/utils/selector'; |
5 | 6 | import type { EdgeData, TreeData } from '@antv/g6'; |
6 | 7 | import { Graph, treeToGraphData } from '@antv/g6'; |
7 | 8 | import { QueryPath, QueryResult } from '@gkd-kit/selector'; |
8 | 9 | import { uniqBy } from 'lodash-es'; |
9 | | -import { AntQuadratic } from '@/utils/g6'; |
10 | 10 |
|
11 | 11 | const props = withDefaults( |
12 | 12 | defineProps<{ |
@@ -74,16 +74,20 @@ const edgeCtx = computed<EdgeContext>(() => { |
74 | 74 | countMap[key] = count + 1; |
75 | 75 | const id = key + (count > 0 ? `-${count}` : ''); |
76 | 76 | edgePathMap[id] = path; |
| 77 | +
|
| 78 | + const _isPrevious = path.connectWrapper.segment.operator.key === '->'; |
| 79 | + const _similarId = [path.source.id, path.target.id, Number(_isPrevious)] |
| 80 | + .sort() |
| 81 | + .join('-'); |
77 | 82 | return { |
78 | 83 | id, |
79 | 84 | source: String(path.source.id), |
80 | 85 | target: String(path.target.id), |
81 | | - _similarId: [path.source.id, path.target.id].sort().join('-'), |
| 86 | + _similarId, |
| 87 | + _isPrevious, |
82 | 88 | }; |
83 | 89 | }; |
84 | | - const getSimilarId = (edge: EdgeData): string => { |
85 | | - return Reflect.get(edge, '_similarId') as string; |
86 | | - }; |
| 90 | + const getSimilarId = (edge: EdgeData) => edge._similarId as string; |
87 | 91 | const resultAndPathList = props.showUnitResults.map((result) => { |
88 | 92 | return { |
89 | 93 | result, |
@@ -115,7 +119,9 @@ const edgeCtx = computed<EdgeContext>(() => { |
115 | 119 | return colorList[i % colorList.length]; |
116 | 120 | }; |
117 | 121 | const getCurveOffset = (edge: EdgeData): number => { |
118 | | - const direction = Number(edge.source) > Number(edge.target) ? 1 : -1; |
| 122 | + const direction = |
| 123 | + (Number(edge.source) > Number(edge.target) ? 1 : -1) * |
| 124 | + (edge._isPrevious ? -1 : 1); |
119 | 125 | const fistSimilarIndex = edgeList.findIndex( |
120 | 126 | (e) => getSimilarId(e) === getSimilarId(edge), |
121 | 127 | ); |
|
0 commit comments