You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea here is that if the current bounds are contained within the
previous bounds, mapbox-gl-js still contains the data and will display
it without another server roundtrip.
The insight that springs from this is that there are two event handlers
that need to be given to the map component:
onBoundsChange: called every time the bounds change. This would be used
to update the url.
onMissingData: called when the current map bounds are outside of
previous bounds. We then have area within the map bounds for which
we need data.
These two callbacks seem to form the basis of a saner API for the map
component.
TODO: Currently we recalculate the summary, after loading data for the
current bounds. If we are now longer hitting the server for each change
of bounds, we now need to ask the map which elements of data are
currently visible and recalculate the summary based on that.
The function that does that is `queryRenderedFeatures`:
`map.queryRenderedFeatures(map.getBounds().toArray(), {layers: [ "markers" , "selected" ]})`
The problem here is that it returns nothing, duplicates or the right
thing seemingly at random.
issue: mapbox/mapbox-gl-js#2647
When that issue is resolved, revisit this.
0 commit comments