Skip to content

Commit

Permalink
improve GeoJsonLayer auto highlighting logic (visgl#6018)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress authored Jul 28, 2021
1 parent 93e81cb commit 1095ba5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/layers/src/geojson-layer/geojson-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,10 @@ export default class GeoJsonLayer extends CompositeLayer {
_updateAutoHighlight(info) {
// All sub layers except the points layer use source feature index to encode the picking color
// The points layer uses indices from the points data array.
const sourceIsPoints = info.sourceLayer.id.includes('-points-');
const pointLayerIdPrefix = `${this.id}-points-`;
const sourceIsPoints = info.sourceLayer.id.startsWith(pointLayerIdPrefix);
for (const layer of this.getSubLayers()) {
if (layer.id.includes('-points-') === sourceIsPoints) {
if (layer.id.startsWith(pointLayerIdPrefix) === sourceIsPoints) {
layer.updateAutoHighlight(info);
}
}
Expand Down

0 comments on commit 1095ba5

Please sign in to comment.