Ensure that relations are called before ways when categorizing fetched features (close #6277)

This commit is contained in:
Quincy Morgan
2019-05-01 11:33:39 -07:00
parent 907df1c10e
commit 949b57d118
+5 -2
View File
@@ -539,11 +539,14 @@ export function rendererFeatures(context) {
// warm up the feature matching cache upon merging fetched data
context.history().on('merge.features', function(entities) {
context.history().on('merge.features', function(newEntities) {
utilCallWhenIdle(function() {
if (!entities) return;
if (!newEntities) return;
var graph = context.graph();
var types = utilArrayGroupBy(newEntities, 'type');
// ensure that getMatches is called on relations before ways
var entities = [].concat(types.relation || [], types.way || [], types.node || []);
for (var i = 0; i < entities.length; i++) {
var geometry = entities[i].geometry(graph);
features.getMatches(entities[i], graph, geometry);