From 11f1572c132ff2293e450985a92fe15f035d733f Mon Sep 17 00:00:00 2001 From: acalcutt Date: Tue, 7 Feb 2023 01:06:19 -0500 Subject: [PATCH] add inspect toggle callback --- public/templates/viewer.tmpl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/public/templates/viewer.tmpl b/public/templates/viewer.tmpl index 816682f..eb2330b 100644 --- a/public/templates/viewer.tmpl +++ b/public/templates/viewer.tmpl @@ -55,10 +55,19 @@ showZoom: true, showCompass: true })); + const inspectUrlTag = '&inspect'; map.addControl(new MaplibreInspect({ showMapPopupOnHover: false, showInspectMapPopupOnHover: false, - selectThreshold: 5 + selectThreshold: 5, + showInspectMap: window.location.hash.includes(inspectUrlTag), + toggleCallback: function(showInspectMap) { + if (showInspectMap) { + window.location.hash += inspectUrlTag; + } else { + window.location.hash = window.location.hash.replace(inspectUrlTag, ''); + } + } })); } else { var map = L.map('map', { zoomControl: false });