Zum Weltpunkt `world` hinzoomen: Zeiger dorthin, dann `steps` Mausrad-Schritte (die Szene zoomt zum Zeiger).
(page, world, steps)
| 932 | |
| 933 | /** Zum Weltpunkt `world` hinzoomen: Zeiger dorthin, dann `steps` Mausrad-Schritte (die Szene zoomt zum Zeiger). */ |
| 934 | async function zoomAt(page, world, steps) { |
| 935 | const box = await canvasBox(page); |
| 936 | const [at] = await page.evaluate((point) => globalThis.__atlasGalaxyFit?.project?.([{ x: point.x, y: point.y, z: 0 }]) ?? [], world); |
| 937 | const x = at ? box.x + Math.min(Math.max(at.x, 20), box.width - 20) : box.x + box.width / 2; |
| 938 | const y = at ? box.y + Math.min(Math.max(at.y, 20), box.height - 20) : box.y + box.height / 2; |
| 939 | await page.mouse.move(x, y); |
| 940 | for (let step = 0; step < steps; step += 1) { await page.mouse.wheel(0, -300); await wait(200); } |
| 941 | // Den Zeiger aus dem Bild nehmen, damit keine Karte eines Knotens ueber der Messung liegt. |
| 942 | await page.mouse.move(box.x + box.width - 4, box.y - 30); |
| 943 | await wait(2000); |
| 944 | } |
| 945 | |
| 946 | /* ------------------------------------------------------------------ */ |
| 947 | /* K12: die Namen im Mini-Galaxy von Explore liegen nicht aufeinander */ |