From 25afccbab80e0b751bb0c8b2324491261ead6e50 Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Thu, 9 Jul 2020 19:07:02 +0300 Subject: [PATCH] fix precedence of promoteId over feature id in fill extrusions (#9863) --- src/data/bucket/fill_extrusion_bucket.js | 12 ++++-------- .../promote-id-fill-extrusion/style.json | 3 +++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/data/bucket/fill_extrusion_bucket.js b/src/data/bucket/fill_extrusion_bucket.js index 0378758ba62..0ec7c6483b3 100644 --- a/src/data/bucket/fill_extrusion_bucket.js +++ b/src/data/bucket/fill_extrusion_bucket.js @@ -101,7 +101,7 @@ class FillExtrusionBucket implements Bucket { if (!this.layers[0]._featureFilter.filter(new EvaluationParameters(this.zoom), evaluationFeature, canonical)) continue; - const patternFeature: BucketFeature = { + const bucketFeature: BucketFeature = { id, sourceLayerIndex, index, @@ -111,17 +111,13 @@ class FillExtrusionBucket implements Bucket { patterns: {} }; - if (typeof feature.id !== 'undefined') { - patternFeature.id = feature.id; - } - if (this.hasPattern) { - this.features.push(addPatternDependencies('fill-extrusion', this.layers, patternFeature, this.zoom, options)); + this.features.push(addPatternDependencies('fill-extrusion', this.layers, bucketFeature, this.zoom, options)); } else { - this.addFeature(patternFeature, patternFeature.geometry, index, canonical, {}); + this.addFeature(bucketFeature, bucketFeature.geometry, index, canonical, {}); } - options.featureIndex.insert(feature, patternFeature.geometry, index, sourceLayerIndex, this.index, true); + options.featureIndex.insert(feature, bucketFeature.geometry, index, sourceLayerIndex, this.index, true); } } diff --git a/test/integration/render-tests/feature-state/promote-id-fill-extrusion/style.json b/test/integration/render-tests/feature-state/promote-id-fill-extrusion/style.json index a4a31d62dfa..b559ba2feca 100644 --- a/test/integration/render-tests/feature-state/promote-id-fill-extrusion/style.json +++ b/test/integration/render-tests/feature-state/promote-id-fill-extrusion/style.json @@ -39,6 +39,7 @@ "type": "FeatureCollection", "features": [{ "type": "Feature", + "id": 1, "geometry": { "type": "Polygon", "coordinates": [ @@ -71,6 +72,7 @@ } }, { "type": "Feature", + "id": 1, "geometry": { "type": "Polygon", "coordinates": [ @@ -103,6 +105,7 @@ } }, { "type": "Feature", + "id": 1, "geometry": { "type": "Polygon", "coordinates": [