* Special color, use source node color or target node color * @param curveProps curve's style to parse * @param orient direction * @param edge current curve data
(curveProps: PathStyleProps, orient: 'horizontal' | 'vertical', edge: GraphEdge)
| 410 | * @param edge current curve data |
| 411 | */ |
| 412 | function applyCurveStyle(curveProps: PathStyleProps, orient: 'horizontal' | 'vertical', edge: GraphEdge) { |
| 413 | switch (curveProps.fill) { |
| 414 | case 'source': |
| 415 | curveProps.fill = edge.node1.getVisual('color'); |
| 416 | curveProps.decal = edge.node1.getVisual('style').decal; |
| 417 | break; |
| 418 | case 'target': |
| 419 | curveProps.fill = edge.node2.getVisual('color'); |
| 420 | curveProps.decal = edge.node2.getVisual('style').decal; |
| 421 | break; |
| 422 | case 'gradient': |
| 423 | const sourceColor = edge.node1.getVisual('color'); |
| 424 | const targetColor = edge.node2.getVisual('color'); |
| 425 | if (isString(sourceColor) && isString(targetColor)) { |
| 426 | curveProps.fill = new graphic.LinearGradient( |
| 427 | 0, 0, +(orient === 'horizontal'), +(orient === 'vertical'), [{ |
| 428 | color: sourceColor, |
| 429 | offset: 0 |
| 430 | }, { |
| 431 | color: targetColor, |
| 432 | offset: 1 |
| 433 | }] |
| 434 | ); |
| 435 | } |
| 436 | } |
| 437 | } |
| 438 | |
| 439 | // Add animation to the view |
| 440 | function createGridClipShape(rect: RectLike, seriesModel: SankeySeriesModel, cb: () => void) { |