From f72731c1da5b44d86d90e311ea4bfb6a8a8d97a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marie=20Wahlstr=C3=B8m?= Date: Wed, 8 Oct 2025 14:01:43 +0200 Subject: [PATCH 1/3] feat: :adhesive_bandage: Prevent multiple clicks on cloud icon for smooth elevation control --- src/ElevationControl/elevationControl.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ElevationControl/elevationControl.js b/src/ElevationControl/elevationControl.js index c4f28ae..f0b59c3 100644 --- a/src/ElevationControl/elevationControl.js +++ b/src/ElevationControl/elevationControl.js @@ -49,6 +49,17 @@ function autoSelectFirstPointCloud() { return false } +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' +} + + //(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 +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(); + } } From 2bacc893f5f7a89628dcc60668a6c155fad3bbbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marie=20Wahlstr=C3=B8m?= Date: Thu, 9 Oct 2025 10:13:11 +0200 Subject: [PATCH 2/3] Update src/ElevationControl/elevationControl.js Co-authored-by: Adrian Haabpiht Solberg --- src/ElevationControl/elevationControl.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ElevationControl/elevationControl.js b/src/ElevationControl/elevationControl.js index f0b59c3..01164ef 100644 --- a/src/ElevationControl/elevationControl.js +++ b/src/ElevationControl/elevationControl.js @@ -56,7 +56,11 @@ function disableFirstPointCloudNode() { if (!li) return; //visually/DOM disable anchor clicks const a = li.querySelector('a'); - if (a) a.style.pointerEvents = 'none' + if (a) { + a.style.pointerEvents = 'none' + a.style.opacity = 0.5 + a.classList.remove('jstree-clicked') + } } From ecd26f629699c16ce675080b0a8566ce6a1f35ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marie=20Wahlstr=C3=B8m?= Date: Thu, 9 Oct 2025 10:16:36 +0200 Subject: [PATCH 3/3] style: :bulb: Update prettier style and comment --- src/ElevationControl/elevationControl.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/ElevationControl/elevationControl.js b/src/ElevationControl/elevationControl.js index 01164ef..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,13 +51,18 @@ 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; + 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'); + const a = li.querySelector('a') if (a) { a.style.pointerEvents = 'none' a.style.opacity = 0.5 @@ -63,7 +70,6 @@ function disableFirstPointCloudNode() { } } - //(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 @@ -126,6 +132,6 @@ export function initElevationControls(viewer) { //Trigger Potree to build Materials UI by selecting the first point cloud (if nothing selected yet) if (autoSelectFirstPointCloud()) { //Prevent multiple clicks on the cloud icon - disableFirstPointCloudNode(); - } + disableFirstPointCloudNode() + } }