Skip to content

Commit 9c46c21

Browse files
rdhyeeclaude
andcommitted
Click cluster dot to fly-to and drill down to next H3 resolution
Clicking an H3 cluster now flies the camera to that location at an altitude that triggers the next resolution level (res4→res6→res8). The zoom watcher then automatically loads finer detail. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1078fe4 commit 9c46c21

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

tutorials/progressive_globe.qmd

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ viewer = {
322322
}
323323
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
324324
325-
// Click handler
325+
// Click handler: fly to cluster and drill down
326326
const clickHandler = new Cesium.ScreenSpaceEventHandler(v.scene.canvas);
327327
clickHandler.setInputAction((e) => {
328328
const picked = v.scene.pick(e.position);
@@ -337,6 +337,20 @@ viewer = {
337337
lng: meta.lng,
338338
resolution: meta.resolution
339339
};
340+
341+
// Fly to the cluster at an altitude that triggers the next resolution
342+
// res4 → fly to 1500km (triggers res6)
343+
// res6 → fly to 150km (triggers res8)
344+
// res8 → fly to 30km (close detail)
345+
const altitudes = { 4: 1500000, 6: 150000, 8: 30000 };
346+
const altitude = altitudes[meta.resolution] || 500000;
347+
348+
v.camera.flyTo({
349+
destination: Cesium.Cartesian3.fromDegrees(
350+
meta.lng, meta.lat, altitude
351+
),
352+
duration: 1.5
353+
});
340354
} else {
341355
mutable clickedInfo = { type: 'point', pid: meta };
342356
}

0 commit comments

Comments
 (0)