@@ -51652,22 +51652,12 @@ var Theme3DLayer = exports.Theme3DLayer = function () {
5165251652 return;
5165351653 }
5165451654 var map = this.map;
51655- if (map.getSource('highlight')) {
51656- map.removeSource('highlight');
51657- }
51658- map.addSource('highlight', {
51659- 'type': 'geojson',
51660- 'data': {
51661- "type": "FeatureCollection",
51662- "features": []
51663- }
51664- });
5166551655 map.addLayer({
5166651656 'id': 'highlightLayer',
5166751657 'type': 'fill-extrusion',
51668- 'source': 'highlight' ,
51669- 'paint': this.getHighlightStyleOptions()
51670-
51658+ 'source': this.sourceId ,
51659+ 'paint': this.getHighlightStyleOptions(),
51660+ "filter": ["in", "$id", ""]
5167151661 });
5167251662
5167351663 var me = this;
@@ -51677,6 +51667,7 @@ var Theme3DLayer = exports.Theme3DLayer = function () {
5167751667 canvas.style.cursor = 'auto';
5167851668
5167951669 var features = map.queryRenderedFeatures(e.point, { layers: [me.id] });
51670+
5168051671 if (me.highlight && me.highlight.callback) {
5168151672 me.highlight.callback(features, e);
5168251673 }
@@ -51685,31 +51676,19 @@ var Theme3DLayer = exports.Theme3DLayer = function () {
5168551676 me._clearHighlight.call(me);
5168651677 return;
5168751678 }
51688-
5168951679 var id = features[0].id;
5169051680 if (featureId === id) {
5169151681 return;
5169251682 }
5169351683 featureId = id;
51694- me._clearHighlight.call(me);
51695- var sourceFeatures = map.querySourceFeatures(me.sourceId, { filter: ['==', '$id', id] });
51696- var i,
51697- len = sourceFeatures.length;
51698- var geoFeatures = { 'type': 'FeatureCollection', 'features': [] };
51699- for (i = 0; i < len; i++) {
51700- geoFeatures['features'].push(sourceFeatures[i].toJSON());
51701- }
51702- map.getSource('highlight').setData(geoFeatures);
51684+ map.setFilter("highlightLayer", ['==', '$id', featureId]);
5170351685 });
5170451686 }
5170551687 }, {
5170651688 key: '_clearHighlight',
5170751689 value: function _clearHighlight() {
5170851690 if (this.map) {
51709- this.map.getSource('highlight').setData({
51710- "type": "FeatureCollection",
51711- "features": []
51712- });
51691+ this.map.setFilter("highlightLayer", ["in", "$id", ""]);
5171351692 }
5171451693 }
5171551694 }, {
0 commit comments