(point: Point, rect: DOMRect)
| 11 | type Polygon = Point[] |
| 12 | |
| 13 | function getExitSideFromRect(point: Point, rect: DOMRect) { |
| 14 | const top = Math.abs(rect.top - point.y) |
| 15 | const bottom = Math.abs(rect.bottom - point.y) |
| 16 | const right = Math.abs(rect.right - point.x) |
| 17 | const left = Math.abs(rect.left - point.x) |
| 18 | |
| 19 | switch (Math.min(top, bottom, right, left)) { |
| 20 | case left: |
| 21 | return 'left' |
| 22 | case right: |
| 23 | return 'right' |
| 24 | case top: |
| 25 | return 'top' |
| 26 | case bottom: |
| 27 | return 'bottom' |
| 28 | default: |
| 29 | return null |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | function getPointsFromRect(rect: DOMRect) { |
| 34 | const { top, right, bottom, left } = rect |
no outgoing calls
no test coverage detected
searching dependent graphs…