Use ol.style.Style and construct style object once
This commit is contained in:
@@ -82,10 +82,7 @@ map.on('singleclick', function(evt) {
|
|||||||
displayFeatureInfo(pixel);
|
displayFeatureInfo(pixel);
|
||||||
});
|
});
|
||||||
|
|
||||||
map.on('postcompose', function(evt) {
|
var highlightStyle = new ol.style.Style({
|
||||||
if (highlight) {
|
|
||||||
var render = evt.getRender();
|
|
||||||
render.drawFeature(highlight, {
|
|
||||||
stroke: new ol.style.Stroke({
|
stroke: new ol.style.Stroke({
|
||||||
color: '#f00',
|
color: '#f00',
|
||||||
width: 1
|
width: 1
|
||||||
@@ -94,5 +91,10 @@ map.on('postcompose', function(evt) {
|
|||||||
color: 'rgba(255,0,0,0.1)'
|
color: 'rgba(255,0,0,0.1)'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
map.on('postcompose', function(evt) {
|
||||||
|
if (highlight) {
|
||||||
|
var render = evt.getRender();
|
||||||
|
render.drawFeature(highlight, highlightStyle);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user