Skip to content

Commit

Permalink
fix(#40): make globe background option work again
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianSolberg committed Oct 25, 2025
1 parent 86ed2ca commit ee4f63a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/AcceptedFiltering/threePanels.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.$
Expand Down Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions src/potreeViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ export async function createPotreeViewer(

overrideGradientSchemeClick(pointclouds);

makeGlobeBackgroundOption()

initMeasurementsPanel(viewer)
initAnnotationsPanel(viewer)
})
Expand Down Expand Up @@ -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();
}
}

0 comments on commit ee4f63a

Please sign in to comment.