From a376f3a2de91d9d18eb5ae8d95575283edcacca6 Mon Sep 17 00:00:00 2001 From: Kleinc Date: Mon, 29 Sep 2025 13:39:36 +0200 Subject: [PATCH] docs(#9): :memo: Added function documentation --- src/coordinateShowing.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/coordinateShowing.js b/src/coordinateShowing.js index ed1a1f1..23ee291 100644 --- a/src/coordinateShowing.js +++ b/src/coordinateShowing.js @@ -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'); @@ -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; @@ -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();