Skip to content

Commit

Permalink
feature(debug): add altitude to displayed coordinates.
Browse files Browse the repository at this point in the history
  • Loading branch information
gchoqueux authored and mgermerie committed Sep 13, 2022
1 parent cdd865c commit e1fea9f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions utils/debug/Debug.js
Expand Up @@ -97,6 +97,7 @@ function Debug(view, datDebugTool, chartDivContainer) {
// camera-target-updated event
let LatController;
let LongController;
let AltiController;
let eventFolder;
const controls = view.controls;
initialPosition.crs = view.referenceCrs;
Expand All @@ -108,12 +109,15 @@ function Debug(view, datDebugTool, chartDivContainer) {
initialPosition.setFromVector3(cursorWorldPosition).as('EPSG:4326', geoPosition);
state.latitude = `${geoPosition.y.toFixed(6)}`;
state.longitude = `${geoPosition.x.toFixed(6)}`;
state.altitude = `${geoPosition.z.toFixed(2)}`;
} else {
state.latitude = '---------';
state.longitude = '---------';
state.altitude = '---------';
}
LatController.updateDisplay();
LongController.updateDisplay();
AltiController.updateDisplay();
};

gui.add(state, 'eventsDebug').name('Debug event').onChange((() => (newValue) => {
Expand All @@ -124,8 +128,11 @@ function Debug(view, datDebugTool, chartDivContainer) {
initialPosition.setFromVector3(getCenter()).as('EPSG:4326', geoPosition);
state.latitude = `${geoPosition.y.toFixed(6)}`;
state.longitude = `${geoPosition.x.toFixed(6)}`;
state.altitude = `${geoPosition.z.toFixed(2)}`;

LatController = eventFolder.add(state, 'latitude');
LongController = eventFolder.add(state, 'longitude');
AltiController = eventFolder.add(state, 'altitude');

view.domElement.addEventListener('mousemove', cameraTargetListener);
} else {
Expand Down

0 comments on commit e1fea9f

Please sign in to comment.