allow updating options.places with an array
This commit is contained in:
parent
487ee4626d
commit
2e5205fabe
1 changed files with 12 additions and 0 deletions
|
@ -117,6 +117,17 @@ Ox.Map = function(options, self) {
|
||||||
that.resizeMap();
|
that.resizeMap();
|
||||||
},
|
},
|
||||||
places: function() {
|
places: function() {
|
||||||
|
if (Ox.isArray(self.options.places)) {
|
||||||
|
self.options.places.forEach(function(place) {
|
||||||
|
if (Ox.isUndefined(place.id)) {
|
||||||
|
place.id = Ox.encodeBase32(Ox.uid());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
self.options.places = Ox.api(self.options.places, {
|
||||||
|
geo: true,
|
||||||
|
sort: '-area'
|
||||||
|
});
|
||||||
|
}
|
||||||
addPlaces();
|
addPlaces();
|
||||||
getMapBounds(function(mapBounds) {
|
getMapBounds(function(mapBounds) {
|
||||||
if (mapBounds) {
|
if (mapBounds) {
|
||||||
|
@ -240,6 +251,7 @@ Ox.Map = function(options, self) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//FIXME: duplicated in update
|
||||||
if (Ox.isArray(self.options.places)) {
|
if (Ox.isArray(self.options.places)) {
|
||||||
self.options.places.forEach(function(place) {
|
self.options.places.forEach(function(place) {
|
||||||
if (Ox.isUndefined(place.id)) {
|
if (Ox.isUndefined(place.id)) {
|
||||||
|
|
Loading…
Reference in a new issue