(
x1: number, y1: number, width: number, height: number, x: number, y: number, out: number[]
)
| 177 | } |
| 178 | |
| 179 | function projectPointToRect( |
| 180 | x1: number, y1: number, width: number, height: number, x: number, y: number, out: number[] |
| 181 | ): number { |
| 182 | if (width < 0) { |
| 183 | x1 = x1 + width; |
| 184 | width = -width; |
| 185 | } |
| 186 | if (height < 0) { |
| 187 | y1 = y1 + height; |
| 188 | height = -height; |
| 189 | } |
| 190 | const x2 = x1 + width; |
| 191 | const y2 = y1 + height; |
| 192 | |
| 193 | const ox = out[0] = Math.min(Math.max(x, x1), x2); |
| 194 | const oy = out[1] = Math.min(Math.max(y, y1), y2); |
| 195 | |
| 196 | return Math.sqrt((ox - x) * (ox - x) + (oy - y) * (oy - y)); |
| 197 | } |
| 198 | |
| 199 | const tmpPt: number[] = []; |
| 200 |
no outgoing calls
no test coverage detected
searching dependent graphs…