(props: PortGroupProps)
| 34 | } |
| 35 | // eslint-disable-next-line jsdoc/require-jsdoc |
| 36 | function Component(props: PortGroupProps) { |
| 37 | const { |
| 38 | id, |
| 39 | children, |
| 40 | // destructure every single layout prop so we can list them individually |
| 41 | position, |
| 42 | width, |
| 43 | height, |
| 44 | } = props; |
| 45 | type Coordinate = number | string | undefined; |
| 46 | let angle: number | undefined; |
| 47 | let x: Coordinate = undefined; |
| 48 | let y: Coordinate = undefined; |
| 49 | let dx: Coordinate = undefined; |
| 50 | let dy: Coordinate = undefined; |
| 51 | let start: Position | undefined = undefined; |
| 52 | let end: Position | undefined = undefined; |
| 53 | let dr: number | undefined = undefined; |
| 54 | let startAngle: number | undefined = undefined; |
| 55 | let step: number | undefined = undefined; |
| 56 | let compensateRotation: boolean | undefined = undefined; |
| 57 | |
| 58 | switch (position) { |
| 59 | case 'absolute': { |
| 60 | angle = props.angle; |
| 61 | x = props.x; |
| 62 | y = props.y; |
| 63 | break; |
| 64 | } |
| 65 | case 'bottom': |
| 66 | case 'top': |
| 67 | case 'left': |
| 68 | case 'right': { |
| 69 | dx = props.dx; |
| 70 | dy = props.dy; |
| 71 | x = props.x; |
| 72 | y = props.y; |
| 73 | angle = props.angle; |
| 74 | break; |
| 75 | } |
| 76 | case 'line': { |
| 77 | // Only assign start/end if both x and y are defined |
| 78 | if (props.start?.x != undefined && props.start.y != undefined) { |
| 79 | start = props.start as Position; |
| 80 | } |
| 81 | if (props.end?.x != undefined && props.end.y != undefined) { |
| 82 | end = props.end as Position; |
| 83 | } |
| 84 | break; |
| 85 | } |
| 86 | case 'ellipse': |
| 87 | case 'ellipseSpread': { |
| 88 | dx = props.dx; |
| 89 | dy = props.dy; |
| 90 | x = props.x; |
| 91 | y = props.y; |
| 92 | dr = props.dr; |
| 93 | startAngle = props.startAngle; |
nothing calls this directly
no test coverage detected