Closed mariocasciaro closed 2 years ago
@mariocasciaro are you asking about L.esri.basemapLayer
or one of the layer types in this plugin? https://github.com/Esri/esri-leaflet-vector#api-reference
Sorry, my mistake. I updated the original post. I was referring to L.esri.Vector.vectorBasemapLayer
.
No worries, thanks for clarifying.
Right now we do not fire events on the layer instance for both L.esri.Vector.vectorBasemapLayer
and L.esri.Vector.vectorTileLayer
; however, (at your own risk) you could try any of these mapbox-gl-js map instance events (
https://docs.mapbox.com/mapbox-gl-js/api/map/#events-data-loading) by accessing like this in your code:
var layer = L.esri.Vector.vectorBasemapLayer("ArcGIS:Streets", {
apiKey: "YOUR KEY HERE"
});
layer.addTo(map);
// access the internal instance of the mapbox-gl-js map like this
// and attach your own listeners such as "styledata", "dataloading", etc.
layer._mapboxGL._glMap.on('styledata', function (e) {
console.log(e);
});
Thanks @jwasilgeo I'll give that a try.
@mariocasciaro are we clear to close this issue after Jacob's suggestion or do we need to leave it open for further exploration? If so, could you provide additional context? Thanks!
Sure, we can close this for now. I will reopen it if we will encounter any issues with the mapbox-gl events.
With
L.esri.basemapLayer
it's currently possible to get notified when all tiles are finished loading by listening to the 'load' event. Similarly, when tiles start loading, the 'loading' event is fired. Those events are not fired when usingL.esri.Vector.vectorBasemapLayer
. Is there any plan to add those events?