mapbox-gl-draw
mapbox-gl-draw copied to clipboard
add control blocked while unassociated layer tiles are loading
setup.js blocks adding a control until map.loaded()
returns true.
if (map.loaded()) {
setup.connect();
} else {
map.on('load', setup.connect);
mapLoadedInterval = setInterval(() => { if (map.loaded()) setup.connect(); }, 16);
}
This is similar to issue https://github.com/mapbox/mapbox-gl-draw/issues/502. The difference between this issue and 502 is that 502 was concerned with load
event only getting fired on initial map load. 502 has been resolved with setInterval check that polls to see of map.loaded()
returns true. The fix for 502 allows controls to be added once all layer tiles are loaded but still blocks adding controls while layer tiles are loading. Why can't a control be added while layer tiles are loading?
Would it be possible to disable map.loaded()
check with an option? So maybe something like
if (ctx.options.onAddSkipMapLoadedCheck || map.loaded()) {
setup.connect();
} else {
map.on('load', setup.connect);
mapLoadedInterval = setInterval(() => { if (map.loaded()) setup.connect(); }, 16);
}
@underoot Who is the best person to contact to start a conversation about this issue? Should I open a PR? I don't see a lot of feedback on open PRs and don't want to open one unless there is some buy-in for the problem and solution.
Thank you for your contribution. We will take a look on that issue when we will have time. Meanwhile, PR is welcome also, we will bring feedback as soon as it will be possible from our side
By the way, could you also elaborate a little bit your case. Why you need controls immediately before tiles are loaded. Thank you!
By the way, could you also elaborate a little bit your case. Why you need controls immediately before tiles are loaded. Thank you!
Our use case is a user created map where users can add layers from many different sources. Some of these sources generate tiles in real time based on current query criteria of the application, for example from Elasticsearch mvt endpoint. Loading tiles may take longer than 30 seconds for extremely large data sets (billions of records). In this example, all records are not returned in the tile, instead, records are grouped into hexagon or grid buckets and aggregated metrics are returned per bucket (like count of records, or average of some numerical value).
Draw controls are provided to allow users to draw geometries on-screen to narrow results. Users would like to be able to use draw controls while tiles are loading.
https://github.com/elastic/kibana/issues/166496 further defines the problem.