Skip to content

Commit

Permalink
fix(feature): return style when filtering features
Browse files Browse the repository at this point in the history
In FeatureUtils, when filtering features under a coordinate, the style
of each feature is returned, in order to be used (in FeatureToolTip for
this case). It is a fix that corrects f703723.

This is not the best fix to do, but the quickest at the time. In the
future, I recommend getting rid of the FeatureUtils and do all the work
directly in Feature/FeatureCollection, and return a partial Feature or
FeatureCollection depending on the case.
  • Loading branch information
zarov committed Jan 30, 2020
1 parent b348207 commit 0e6d94a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/js/plugins/FeatureToolTip.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ var FeatureToolTip = (function _() {
feature = features[p];

geometry = feature.geometry;
style = (layer.style && layer.style.isStyle) ? layer.style : (geometry._feature.style || geometry.properties.style);
style = (layer.style && layer.style.isStyle) ? layer.style : feature.style;
fill = style.fill.color;
stroke = '1.25px ' + style.stroke.color;

Expand Down
1 change: 1 addition & 0 deletions src/Utils/FeaturesUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ function isFeatureUnderCoordinate(coordinate, feature, epsilon, result) {
type: feature.type,
geometry,
coordinates: under.coordinates /* || coordinates */,
style: feature.style,
});
}
}
Expand Down

0 comments on commit 0e6d94a

Please sign in to comment.