Skip to content

Commit

Permalink
Merge pull request #4059 from camptocamp/GSGMF-554_2.2
Browse files Browse the repository at this point in the history
Only change the colors when updating an image style
  • Loading branch information
fredj authored Jul 26, 2018
2 parents eb2dbec + 8e6c3cf commit f43908e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions contribs/gmf/src/directives/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -771,13 +771,19 @@ gmf.SearchController.prototype.getSearchStyle_ = function(feature, resolution) {
if (fillStyle) {
fillStyle.setColor(fillColor);
}
const image = style.getImage();
if (image) {
style.setImage(new ol.style.Circle({
fill: new ol.style.Fill({color: fillColor}),
radius: 5,
stroke: new ol.style.Stroke({color: strokeColor})
}));
// the image style can't be changed in place, the colors are updated on a clone.
let imageStyle = style.getImage();
if (imageStyle) {
imageStyle = imageStyle.clone();
const imageStrokeStyle = imageStyle.getStroke();
if (imageStrokeStyle) {
imageStrokeStyle.setColor(strokeColor);
}
const imageFillStyle = imageStyle.getFill();
if (imageFillStyle) {
imageFillStyle.setColor(fillColor);
}
style.setImage(imageStyle);
}
}
return style;
Expand Down

0 comments on commit f43908e

Please sign in to comment.