fix(import): fly to points-only files without going underground

viewer.flyTo frames ground-clamped billboards before the destination's
terrain has loaded, and their bounding sphere then sits kilometers below
the surface: flying to a points-only GeoJSON from another city left the
camera about 2.3 km underground (a black screen). Frame the features'
longitudes and latitudes at the surface instead, and let the existing
camera ground guard lift the eye once the terrain can be measured
(src/ui/flyToDataSource.js, with tests).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
kapturnerandClaude Opus 5.5 committed 2026-10-07 08:50:35 -05:00
1 parent 57b8d8b23c
commit 2fec1091d4
6 files changed
+139 -3

No files matched your search

+5 -1
View File
@@ -17,6 +17,7 @@ import {
MAX_IMPORTED_FILES,
loadGeoFile,
} from '../data/geoFileImport.js';
import { flyToDataSource } from './flyToDataSource.js';
// One color per file, in import order, from the whiteboard palette.
const COLORS = ['#39d0ff', '#ffb547', '#5dff9f', '#ff6b6b', '#8be9ff'];
@@ -33,6 +34,7 @@ export function initGeoFileImport({
viewer,
load = loadGeoFile,
document: doc = globalThis.document,
flyToSource = flyToDataSource,
}) {
const button = doc?.getElementById('geo-import-button');
const input = doc?.getElementById('geo-import-input');
@@ -120,7 +122,9 @@ export function initGeoFileImport({
const item = find(id);
if (!item) return false;
if (!item.visible) setVisible(id, true);
viewer.flyTo?.(item.dataSource, { duration: 1.5 });
// Not viewer.flyTo: it frames ground-clamped points underground until
// the destination's terrain has loaded (see ./flyToDataSource.js).
flyToSource(viewer, item.dataSource);
return true;
}