Skip to content

Commit

Permalink
style(#40): run prettier formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianSolberg committed Oct 25, 2025
1 parent 843b1c8 commit d1580ad
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/AcceptedFiltering/threePanels.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function insertSection({ headerId, headerText, listId }) {
menu.appendChild(header)
menu.appendChild(panel)
}

accordionRefresh()

header.addEventListener('click', () => {
Expand Down
55 changes: 28 additions & 27 deletions src/potreeViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,27 @@ export async function createPotreeViewer(
$('#menu_filters').next().show()
viewer.toggleSidebar()

// Store the last used elevation gradient
let lastElevationGradient = 'VIRIDIS';
// Store the last used elevation gradient
let lastElevationGradient = 'VIRIDIS'

// Helper function to update all point clouds' elevation range
function updateAllCloudsElevation(range) {
pointclouds.forEach(pc => {
pointclouds.forEach((pc) => {
pc.material.activeAttributeName = 'elevation'
pc.material.elevationRange = range
})
}

// Helper function to update all point clouds' gradient
function updateAllCloudsGradient(gradientName) {
pointclouds.forEach(pc => {
pointclouds.forEach((pc) => {
pc.material.gradient = Potree.Gradients[gradientName]
})
}

// Helper function to update all point clouds for Accepted filtering
function updateAllCloudsAccepted(gradientName) {
pointclouds.forEach(pc => {
pointclouds.forEach((pc) => {
pc.material.activeAttributeName = 'Accepted'
pc.material.gradient = Potree.Gradients[gradientName]
})
Expand Down Expand Up @@ -98,11 +98,11 @@ export async function createPotreeViewer(
}

function setLastElevationGradient(gradientName) {
lastElevationGradient = gradientName;
lastElevationGradient = gradientName
}
overrideGradientSchemeClick(pointclouds, setLastElevationGradient);
overrideGradientSchemeClick(pointclouds, setLastElevationGradient)

makeGlobeBackgroundOption()
makeGlobeBackgroundOption()

initMeasurementsPanel(viewer)
initAnnotationsPanel(viewer)
Expand Down Expand Up @@ -309,7 +309,6 @@ function suppressSidebarAutoScroll(action, holdMs = 350) {
}
}


/**
* Overrides the click event handlers for gradient scheme selection to apply
* gradients to multiple point clouds.
Expand All @@ -318,36 +317,38 @@ function suppressSidebarAutoScroll(action, holdMs = 350) {
* @param {Function} setLastElevationGradient - Callback function to store the last selected gradient name
*/
function overrideGradientSchemeClick(pointclouds, setLastElevationGradient) {
const gradientContainer = document.getElementById('elevation_gradient_scheme_selection');
const spans = gradientContainer.querySelectorAll('span');
const gradientContainer = document.getElementById(
'elevation_gradient_scheme_selection'
)
const spans = gradientContainer.querySelectorAll('span')
if (spans.length) {
spans.forEach((span, idx) => {
span.onclick = () => {
const gradientNames = Object.keys(Potree.Gradients);
const gradientName = gradientNames[idx];
const gradientNames = Object.keys(Potree.Gradients)
const gradientName = gradientNames[idx]
if (gradientName) {
pointclouds.forEach(pc => {
pc.material.gradient = Potree.Gradients[gradientName];
});
setLastElevationGradient(gradientName);
pointclouds.forEach((pc) => {
pc.material.gradient = Potree.Gradients[gradientName]
})
setLastElevationGradient(gradientName)
}
};
});
}
})
}
}

/**
* 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"]');
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();
bgLabel.textContent = 'Globe'
bgInput.id = 'background_options_globe'
bgInput.value = 'globe'
bgLabel.setAttribute('for', 'background_options_globe')
bgLabel.click()
}
}
}

0 comments on commit d1580ad

Please sign in to comment.