Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only change the colors when updating an image style #4059

Merged
merged 1 commit into from
Jul 26, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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