mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +00:00
feat(cctv): focus nearest camera to an explicit point
This commit is contained in:
1 parent
e7707d9a0f
commit
2863bd8951
4 files changed
+113
-9
No files matched your search
Vendored
+19
@@ -336,6 +336,25 @@ export function createControls({ state: layerState, services, parts, source }) {
|
||||
return nextId;
|
||||
},
|
||||
|
||||
/**
|
||||
* Selects the camera nearest an explicit WGS84 point and optionally flies.
|
||||
* @param {number} lat Latitude in degrees.
|
||||
* @param {number} lon Longitude in degrees.
|
||||
* @param {Object} [options={}]
|
||||
* @param {boolean} [options.focus=true] Whether to fly after selection.
|
||||
* @param {number} [options.durationSec] Fly-to duration in seconds.
|
||||
* @returns {string|null} The nearest camera ID, or null if none found.
|
||||
*/
|
||||
focusNearestToPoint(lat, lon, options = {}) {
|
||||
const nearest = parts.navigation.nearestCameraIdToPoint(lat, lon);
|
||||
if (!nearest) return null;
|
||||
parts.selection.setActiveCamera(nearest);
|
||||
if (options.focus !== false) {
|
||||
parts.navigation.focusCamera(nearest, options.durationSec || 1.8);
|
||||
}
|
||||
return nearest;
|
||||
},
|
||||
|
||||
/**
|
||||
* Selects and flies to the camera nearest the current viewer position.
|
||||
* @param {Object} [options={}]
|
||||
|
||||
Reference in new issue
Block a user