diff --git a/index.html b/index.html index ce7fdbb..b9c3d02 100644 --- a/index.html +++ b/index.html @@ -71,7 +71,9 @@

Target point:

-

+

Latitude:

+

Longitude:

+

Elevation:

diff --git a/src/CoordinateShowing/coordinateShowing.css b/src/CoordinateShowing/coordinateShowing.css index 7cb0148..64dedf3 100644 --- a/src/CoordinateShowing/coordinateShowing.css +++ b/src/CoordinateShowing/coordinateShowing.css @@ -23,11 +23,12 @@ padding-bottom: 20px; font-weight: bold; } -#coordinates { +#latitude, +#longitude, +#elevation { color: #cccccc; font-family: Arial, Helvetica, sans-serif; font-size: 18px; - line-height: 0.75; position: relative; margin: 0; } diff --git a/src/CoordinateShowing/coordinateShowing.js b/src/CoordinateShowing/coordinateShowing.js index def0c9b..9845bd3 100644 --- a/src/CoordinateShowing/coordinateShowing.js +++ b/src/CoordinateShowing/coordinateShowing.js @@ -1,7 +1,9 @@ import { ecef } from '../config.js' import { wgs84 } from '../config.js' -const coordinatesText = document.getElementById('coordinates') +const latitudeText = document.getElementById('latitude') +const longitudeText = document.getElementById('longitude') +const elevationText = document.getElementById('elevation') const coordinatesContainer = document.getElementById('coordinatesContainer') let isRightClick = false @@ -41,9 +43,9 @@ export function updateText() { if (controls === window.potreeViewer.orbitControls) { coordinatesContainer.style.display = 'inline' - coordinatesText.innerText = `Latitude = ${lat.toFixed(4)}˚ - \n Longitude = ${lon.toFixed(4)}˚ - \n Elevation = ${elevation.toFixed(4)}m` + latitudeText.textContent = `Latitude = ${lat.toFixed(4)}˚` + longitudeText.textContent = `Longitude = ${lon.toFixed(4)}˚` + elevationText.textContent = `Elevation = ${elevation.toFixed(4)}m` } else { coordinatesContainer.style.display = 'none' } diff --git a/src/main.js b/src/main.js index b72a825..462edd4 100644 --- a/src/main.js +++ b/src/main.js @@ -16,6 +16,7 @@ async function init() { POTREE_SETTINGS ) + potreeViewer.addEventListener('camera_changed', updateText) setupRightClickListener(potreeViewer) function loop(timestamp) { @@ -24,7 +25,6 @@ async function init() { potreeViewer.render() syncCameras(potreeViewer, cesiumViewer) cesiumViewer.render() - updateText() } requestAnimationFrame(loop)