add inspect toggle callback
This commit is contained in:
parent
af48edeb48
commit
11f1572c13
1 changed files with 10 additions and 1 deletions
|
|
@ -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 });
|
||||
|
|
|
|||
Loading…
Reference in a new issue