(panel)
| 4518 | 'wifi-hm-seg-btn ' + (!survey ? 'wifi-hm-seg-on' : 'wifi-hm-seg-off'); |
| 4519 | document.getElementById('wifi-hm-design-tools').classList.toggle('hidden', survey); |
| 4520 | _wifiHm.wallStart = null; |
| 4521 | wifiHeatmapRender(); |
| 4522 | } |
| 4523 | |
| 4524 | function wifiHmSetTool(t) { |
| 4525 | _wifiHm.tool = t; |
| 4526 | _wifiHm.wallStart = null; |
| 4527 | const sel = (id, on) => { const el = document.getElementById(id); if (el) |
| 4528 | el.className = 'wifi-hm-seg-btn ' + (on ? 'wifi-hm-seg-on' : 'wifi-hm-seg-off'); }; |
| 4529 | sel('wifi-hm-tool-wall', t === 'wall'); |
| 4530 | sel('wifi-hm-tool-ap', t === 'ap'); |
| 4531 | sel('wifi-hm-tool-column', t === 'column'); |
| 4532 | sel('wifi-hm-tool-floorplan', t === 'floorplan'); |
| 4533 | const st = document.getElementById('wifi-hm-design-status'); |
| 4534 | const msg = { wall: 'Click two points to draw a wall — or drag an existing wall to move it.', |
| 4535 | ap: 'Click the plan to drop an AP node (add several for a mesh) — or drag a node to move it.', |
| 4536 | column: 'Click to drop a structural column (pillar) — drag it to move, or drag its white edge handle to resize. Columns shadow WiFi behind them.', |
| 4537 | floorplan: 'Drag the image to move it; drag its blue corner handle to resize. Line the plan up with the metre grid, then switch back to a placement tool. Use Fit to reset.' }; |
| 4538 | if (st) st.textContent = msg[t] || ''; |
| 4539 | } |
| 4540 | |
| 4541 | // ---- Drag existing objects (AP nodes + walls) ------------------------------ |
| 4542 | function _wifiPtSegDistPx(px, py, x1, y1, x2, y2) { |
| 4543 | const dx = x2 - x1, dy = y2 - y1; |
| 4544 | const len2 = dx * dx + dy * dy; |
| 4545 | let t = len2 ? ((px - x1) * dx + (py - y1) * dy) / len2 : 0; |
| 4546 | t = Math.max(0, Math.min(1, t)); |
| 4547 | return Math.hypot(px - (x1 + t * dx), py - (y1 + t * dy)); |
| 4548 | } |
| 4549 | |
| 4550 | // Screen-space radius (px) a column is drawn at — kept in sync with _wifiHmDrawDesign. |
| 4551 | function _wifiHmColumnPxRadius(c, vp) { |
no test coverage detected