Skip to content

Commit

Permalink
Merge pull request #20 from Kanahiro/inspectr
Browse files Browse the repository at this point in the history
popup timing
  • Loading branch information
Kanahiro authored Aug 25, 2024
2 parents 6f64948 + 8a50077 commit e0f4665
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,19 @@
map.addControl(new ViewstateControl());
map.addControl(new maplibregl.NavigationControl());

map.addControl(
const inspect = new MaplibreInspect({
// loaded from CDN
new MaplibreInspect({
popup: new maplibregl.Popup({
closeButton: false,
closeOnClick: false,
}),
popup: new maplibregl.Popup({
closeButton: false,
closeOnClick: false,
}),
);
});
map.addControl(inspect);

map.on('click', (e) => {
if (inspect.showInspectMap) {
return;
}
// detect layers
const features = map.queryRenderedFeatures(e.point);
const layerIds = features.map((f) => f.layer.id);
Expand Down

0 comments on commit e0f4665

Please sign in to comment.