| 4119 | // AP at center |
| 4120 | ctx.beginPath(); ctx.arc(cx, cy, 6, 0, 2 * Math.PI); ctx.fillStyle = _WIFI_BAND_COLOR[d.band] || '#38bdf8'; ctx.fill(); |
| 4121 | // Your position (on the data ring direction) |
| 4122 | if (d.current_distance_m) { |
| 4123 | const yr = Math.min(d.current_distance_m * scale, Math.min(W, H) / 2 - 6); |
| 4124 | const px = cx + yr * 0.71, py = cy - yr * 0.71; |
| 4125 | ctx.beginPath(); ctx.arc(px, py, 4, 0, 2 * Math.PI); ctx.fillStyle = '#fff'; ctx.fill(); |
| 4126 | ctx.fillStyle = '#cbd5e1'; ctx.font = '9px sans-serif'; ctx.textAlign = 'left'; |
| 4127 | ctx.fillText('you (' + d.current_distance_m + 'm)', px + 6, py); |
| 4128 | } |
| 4129 | } |
| 4130 | |
| 4131 | // ---- WiFi coverage heatmap (walk-around survey) ---------------------------- |
| 4132 | const _wifiHm = { floorplan: null, data: null, inited: false, metric: 'rssi', |
| 4133 | mode: 'survey', tool: 'wall', walls: [], columns: [], predictAps: [], predicting: true, |
| 4134 | wallStart: null, mesh: false, drag: null, dragMoved: false, suppressClick: false, fp: null, |
| 4135 | view: { zoom: 1, cx: 0.5, cy: 0.5 }, pan: null }; |
| 4136 | |
| 4137 | // ---- Floor scale + zoomable viewport --------------------------------------- |
| 4138 | // The floor is a square of `floorM` × `floorM` metres; every stored coordinate |
| 4139 | // stays normalized 0..1 across that square (backend-compatible). The viewport |
| 4140 | // maps a zoomed/panned window of the floor onto the plot area of the canvas, |
| 4141 | // leaving margins for the metre rulers. |
| 4142 | function _wifiHmFloorM() { |