diff --git a/src/ElevationControl/elevationControl.js b/src/ElevationControl/elevationControl.js
index c4f28ae..5636e8a 100644
--- a/src/ElevationControl/elevationControl.js
+++ b/src/ElevationControl/elevationControl.js
@@ -37,7 +37,9 @@ window.createElevationPanel = function createElevationPanel(viewer) {
}
}
-//Select the fist pointcloud in the sidebar so that the Elevation section is built
+/**
+ * Select the fist pointcloud in the sidebar so that the Elevation section is built
+ */
function autoSelectFirstPointCloud() {
const cloudIcon = document.querySelector(
'#scene_objects i.jstree-themeicon-custom'
@@ -49,6 +51,25 @@ function autoSelectFirstPointCloud() {
return false
}
+/**
+ * Disable any further clicks of the pointcloud icon in the sidebar
+ */
+function disableFirstPointCloudNode() {
+ // find the
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'
+ a.style.opacity = 0.5
+ a.classList.remove('jstree-clicked')
+ }
+}
+
//(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
@@ -109,5 +130,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()
+ }
}