mirror of
https://github.com/Leaflet/Leaflet.VectorGrid.git
synced 2025-07-21 23:48:00 +00:00
Add interactive points demo to the readme
This commit is contained in:
@ -6,3 +6,5 @@ gobblefile.js
|
||||
aux
|
||||
.gobble
|
||||
.gobble-build
|
||||
yarn.lock
|
||||
demo
|
||||
|
@ -20,6 +20,8 @@ With sliced TopoJSON: http://leaflet.github.io/Leaflet.VectorGrid/dist/demo/demo
|
||||
|
||||
With protobuf `VectorTile`s: http://leaflet.github.io/Leaflet.VectorGrid/dist/demo/demo-vectortiles.html
|
||||
|
||||
With clickable points and lines (from protobuf tiles): http://leaflet.github.io/Leaflet.VectorGrid/dist/demo/demo-points.html
|
||||
|
||||
|
||||
## Using
|
||||
|
||||
|
@ -70,7 +70,7 @@
|
||||
road_label: [],
|
||||
housenum_label: [],
|
||||
},
|
||||
interactive: true,
|
||||
interactive: true, // Make sure that this VectorGrid fires mouse/pointer events
|
||||
getFeatureId: function(f) {
|
||||
return f.properties.osm_id;
|
||||
}
|
||||
@ -86,7 +86,7 @@
|
||||
highlight = null;
|
||||
};
|
||||
var pbfLayer = L.vectorGrid.protobuf(url, vectorTileOptions)
|
||||
.on('click', function(e) {
|
||||
.on('click', function(e) { // The .on method attaches an event handler
|
||||
L.popup()
|
||||
.setContent(e.layer.properties.name || e.layer.properties.type)
|
||||
.setLatLng(e.latlng)
|
||||
@ -113,4 +113,4 @@
|
||||
map.setView([40.9994639, -74.163208], 15);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user