Skip to content

Commit

Permalink
Merge pull request #19 from Kanahiro/inspectr
Browse files Browse the repository at this point in the history
Add inspect mode
  • Loading branch information
Kanahiro authored Aug 25, 2024
2 parents 6f0568d + 6fc750f commit 6f64948
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "MapLibre",
"description": "",
"publisher": "kiguchi",
"version": "0.0.11",
"version": "0.0.12",
"engines": {
"vscode": "^1.92.0"
},
Expand Down
16 changes: 16 additions & 0 deletions src/viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
rel="stylesheet"
/>
<script src="https://unpkg.com/pmtiles@^3.0.0/dist/pmtiles.js"></script>
<!-- inspect -->
<script src="https://unpkg.com/@maplibre/maplibre-gl-inspect@latest/dist/maplibre-gl-inspect.js"></script>
<link
href="https://unpkg.com/@maplibre/maplibre-gl-inspect@latest/dist/maplibre-gl-inspect.css"
rel="stylesheet"
/>
</head>
<body>
<div id="error"></div>
Expand Down Expand Up @@ -100,6 +106,16 @@
map.addControl(new ViewstateControl());
map.addControl(new maplibregl.NavigationControl());

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

map.on('click', (e) => {
// detect layers
const features = map.queryRenderedFeatures(e.point);
Expand Down

0 comments on commit 6f64948

Please sign in to comment.