Commit e5a9683a authored by ncastejon's avatar ncastejon
Browse files

Remove deepclone to display the feature details into the panel.

parent 52efa409
......@@ -149,6 +149,7 @@ export class MapService {
addClickEventOnLayer(layer: string) {
this._map.on('click', layer, (e) => {
this.selectedFeature = e.features[0].id;
// Reset the hover and highglithed state for the current and previous feature
this.changeFeatureState(this.hoveredFeatureId, { highlight: false });
......@@ -160,12 +161,7 @@ export class MapService {
const feature = e.features[0];
this.handleMapPosition(e.point.x, e.lngLat, () => {
const featureCloned = cloneDeep(feature);
// Remove the generated id from the properties to be displayed
delete featureCloned.id;
this._panelState.next({ state: true, properties: featureCloned.properties });
this._panelState.next({ state: true, properties: feature.properties });
});
});
}
......@@ -440,16 +436,9 @@ export class MapService {
}
closePanel() {
this.changeFeatureState(this.highlightedFeatureId, { highlight: false });
this.selectedFeature = null;
if (this._map.getLayer('polygon-features-highlight')) {
this._map.setLayoutProperty('polygon-features-highlight', 'visibility', 'none');
}
if (this._map.getLayer('line-features-highlight')) {
this._map.setLayoutProperty('line-features-highlight', 'visibility', 'none');
}
if (this._map.getLayer('unclustered-point-highlighted')) {
this._map.setLayoutProperty('unclustered-point-highlighted', 'visibility', 'none');
}
this.highlightedFeatureId = null;
this._panelState.next({ state: false });
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment