From ee4f63a820ef7ce6076eca1861ee0ca956308f03 Mon Sep 17 00:00:00 2001 From: AdrianSolberg Date: Sat, 25 Oct 2025 21:01:39 +0200 Subject: [PATCH] fix(#40): make globe background option work again --- src/AcceptedFiltering/threePanels.js | 4 ++-- src/potreeViewer.js | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/AcceptedFiltering/threePanels.js b/src/AcceptedFiltering/threePanels.js index 9722f28..a807b07 100644 --- a/src/AcceptedFiltering/threePanels.js +++ b/src/AcceptedFiltering/threePanels.js @@ -182,7 +182,7 @@ function ensureElevationButton(hooks) { /** * Sets up a elevation range slider for interactive updates - * @param hooks - Callback object with onElevationRangeChange method + * @param {{onElevationRangeChange?:Function}} hooks */ function setUpElevationSlider(hooks) { const $ = window.jQuery || window.$ @@ -413,7 +413,7 @@ function attachSelfHealing(activeGetter) { /** * Public entrypoint: builds Elevation and Accepted panels and wires behavior. * @param {object} viewer Potree viewer (not used directly here but available to hooks) - * @param {{onActivateElevation?:Function, onActivateAccepted?:Function, selectCloudOnce?:Function}} hooks + * @param {{onActivateElevation?:Function, onActivateAccepted?:Function, selectCloudOnce?:Function, onElevationRangeChange?:Function}} hooks */ export function initThreePanels(viewer, hooks = {}) { // Build sections diff --git a/src/potreeViewer.js b/src/potreeViewer.js index 79ba064..4f9bba2 100644 --- a/src/potreeViewer.js +++ b/src/potreeViewer.js @@ -96,6 +96,8 @@ export async function createPotreeViewer( overrideGradientSchemeClick(pointclouds); + makeGlobeBackgroundOption() + initMeasurementsPanel(viewer) initAnnotationsPanel(viewer) }) @@ -324,4 +326,20 @@ function overrideGradientSchemeClick(pointclouds) { }; }); } +} + +/** + * Converts the "None" background option to a "Globe" background option and sets it as the default. + */ +function makeGlobeBackgroundOption() { + const bgInput = document.getElementById('background_options_none'); + const bgLabel = document.querySelector('label[for="background_options_none"]'); + + if (bgInput && bgLabel) { + bgLabel.textContent = 'Globe'; + bgInput.id = 'background_options_globe'; + bgInput.value = 'globe'; + bgLabel.setAttribute('for', 'background_options_globe'); + bgLabel.click(); + } } \ No newline at end of file