Skip to content

Commit

Permalink
docs(#9): 📝 Added function documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kleinc committed Sep 29, 2025
1 parent 043ca86 commit a376f3a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/coordinateShowing.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ let posCtx = posCanvas.getContext('2d');
const elevationCanvas = document.getElementById('elevationCanvas');
let elevationCtx = elevationCanvas.getContext('2d');


/**
* Resizes the canvas and its context to account for device pixel ratio.
* @param {*} canvas - The canvas element to resize.
* @returns {*} - The resized canvas context.
*/
function resizeCanvas(canvas) {
const dpr = window.devicePixelRatio || 1;
const ctx = canvas.getContext('2d');
Expand All @@ -22,10 +26,12 @@ function resizeCanvas(canvas) {
return ctx;
}

/**
* Updates the camera overlay with the current latitude and longitude.
*/
function updateCameraOverlay() {
const cam = window.viewer.scene.view.position;
const [lon, lat] = proj4(utm33, wgs84, [cam.x, cam.y]); // Conversion using proj4js library

const centerX = posCanvas.clientWidth / 2;
const centerY = posCanvas.clientHeight / 2;

Expand All @@ -37,7 +43,9 @@ function updateCameraOverlay() {
posCtx.fillText(`lat = ${lat.toFixed(2)}˚ lon = ${lon.toFixed(2)}˚`, centerX, centerY);
}


/**
* Displays the target elevation when in orbit mode.
*/
function targetElevation() {
const pivot = window.viewer.scene.view.getPivot();
const mode = window.viewer.getControls();
Expand Down

0 comments on commit a376f3a

Please sign in to comment.