From 2cf1febd01b133a69ccbadc8851587c76bef3505 Mon Sep 17 00:00:00 2001 From: AdrianSolberg Date: Sun, 26 Oct 2025 20:09:43 +0100 Subject: [PATCH] refactor(#13): remove unused tools --- src/MiniMap/miniMap.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/MiniMap/miniMap.js b/src/MiniMap/miniMap.js index dacd026..53d044c 100644 --- a/src/MiniMap/miniMap.js +++ b/src/MiniMap/miniMap.js @@ -4,11 +4,14 @@ * @param {Potree.Viewer} viewer - The Potree viewer instance */ export function initMiniMap(viewer) { + if (!viewer.mapView) return; const map = viewer.mapView.map const layers = map.getLayers() replaceMiniMapLayers(layers) + removeTileTools(map) + overrideMapViewUpdate(viewer) // Transform minimap center [lon, lat] from EPSG:4326 to EPSG:3857 @@ -41,6 +44,19 @@ function replaceMiniMapLayers(layers) { layers.remove(extentLayer) } +/** + * Removes the tools for downloading and showing/hiding tiles, denoted D and T in the minimap. + * + * @param {ol.Map} map - The OpenLayers map instance + */ +function removeTileTools(map) { + map.getControls().forEach(control => { + if (control.constructor && control.constructor.name === 'DownloadSelectionControl') { + map.removeControl(control); + } + }); +} + /** * Overrides the minimap pointer update logic to use 3D coordinates and correct direction. *