Create styles only once

This commit is contained in:
ahocevar
2014-02-06 05:47:34 +01:00
parent ef200e8b03
commit a4101d52cf
+6 -3
View File
@@ -35,8 +35,8 @@ google.maps.event.addListenerOnce(gmap, 'tilesloaded', function() {
url: 'data/geojson/countries.geojson', url: 'data/geojson/countries.geojson',
projection: 'EPSG:3857' projection: 'EPSG:3857'
}), }),
styleFunction: function(feature, resolution) { styleFunction: (function() {
return [new ol.style.Style({ var styleArray = [new ol.style.Style({
fill: new ol.style.Fill({ fill: new ol.style.Fill({
color: 'rgba(255, 255, 255, 0.6)' color: 'rgba(255, 255, 255, 0.6)'
}), }),
@@ -45,7 +45,10 @@ google.maps.event.addListenerOnce(gmap, 'tilesloaded', function() {
width: 1 width: 1
}) })
})]; })];
} return function(feature, resolution) {
return styleArray;
};
}())
}); });
var center = gmap.getCenter(); var center = gmap.getCenter();