| 71 | } |
| 72 | |
| 73 | buildPath(ctx: CanvasRenderingContext2D, shape: SankeyPathShape) { |
| 74 | const extent = shape.extent; |
| 75 | ctx.moveTo(shape.x1, shape.y1); |
| 76 | ctx.bezierCurveTo( |
| 77 | shape.cpx1, shape.cpy1, |
| 78 | shape.cpx2, shape.cpy2, |
| 79 | shape.x2, shape.y2 |
| 80 | ); |
| 81 | if (shape.orient === 'vertical') { |
| 82 | ctx.lineTo(shape.x2 + extent, shape.y2); |
| 83 | ctx.bezierCurveTo( |
| 84 | shape.cpx2 + extent, shape.cpy2, |
| 85 | shape.cpx1 + extent, shape.cpy1, |
| 86 | shape.x1 + extent, shape.y1 |
| 87 | ); |
| 88 | } |
| 89 | else { |
| 90 | ctx.lineTo(shape.x2, shape.y2 + extent); |
| 91 | ctx.bezierCurveTo( |
| 92 | shape.cpx2, shape.cpy2 + extent, |
| 93 | shape.cpx1, shape.cpy1 + extent, |
| 94 | shape.x1, shape.y1 + extent |
| 95 | ); |
| 96 | } |
| 97 | ctx.closePath(); |
| 98 | } |
| 99 | |
| 100 | highlight() { |
| 101 | enterEmphasis(this); |