Check if a point is within the visible viewport (with margin).
(wx: number, wy: number)
| 1400 | |
| 1401 | /** Check if a point is within the visible viewport (with margin). */ |
| 1402 | private isInViewport(wx: number, wy: number): boolean { |
| 1403 | const sx = wx * this.vp.scale + this.vp.x; |
| 1404 | const sy = wy * this.vp.scale + this.vp.y; |
| 1405 | const mx = this.width * VIEWPORT_CULL_MARGIN; |
| 1406 | const my = this.height * VIEWPORT_CULL_MARGIN; |
| 1407 | return ( |
| 1408 | sx >= -mx && sx <= this.width + mx && sy >= -my && sy <= this.height + my |
| 1409 | ); |
| 1410 | } |
| 1411 | |
| 1412 | private redrawAllEdges(): void { |
| 1413 | if (!this.edgeBgGfx || !this.edgeFgGfx) return; |