Skip to content

Commit

Permalink
feat: 🩹 Prevent multiple clicks on cloud icon for smooth elevation co…
Browse files Browse the repository at this point in the history
…ntrol
  • Loading branch information
mariewah committed Oct 8, 2025
1 parent 6cf61d1 commit f72731c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/ElevationControl/elevationControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ function autoSelectFirstPointCloud() {
return false
}

function disableFirstPointCloudNode() {
// find the <li> that holds the first cloud icon
const icon = document.querySelector('#scene_objects i.jstree-themeicon-custom')
const li = icon ? icon.closest('li') : null;
if (!li) return;
//visually/DOM disable anchor clicks
const a = li.querySelector('a');
if (a) a.style.pointerEvents = 'none'
}


//(re)connect the elevation labels to the slider after the container is moved (was not handled by default)
function rebindElevationLabel() {
const slider = window.jQuery ? window.jQuery('#sldHeightRange') : null
Expand Down Expand Up @@ -109,5 +120,8 @@ export function initElevationControls(viewer) {
observer.observe(menu, { childList: true, subtree: true })

//Trigger Potree to build Materials UI by selecting the first point cloud (if nothing selected yet)
autoSelectFirstPointCloud()
if (autoSelectFirstPointCloud()) {
//Prevent multiple clicks on the cloud icon
disableFirstPointCloudNode();
}
}

0 comments on commit f72731c

Please sign in to comment.