Ox.Map: add public methods getCenter and setCenter

This commit is contained in:
rolux 2012-09-01 13:15:47 +02:00
parent dfffe99a04
commit f4cdfb3349

View file

@ -1476,6 +1476,17 @@ Ox.Map = function(options, self) {
addPlaceToPlaces(data); addPlaceToPlaces(data);
}; };
/*@
getCenter <f> Returns the map center
() -> <o> Map center
lat <n> Latitude
lng <n> Longitude
@*/
that.getCenter = function() {
var center = self.map.getCenter();
return {lat: center.lat(), lng: center.lng()};
};
/*@ /*@
getKey <f> getKey getKey <f> getKey
() -> <o> get key () -> <o> get key
@ -1579,6 +1590,18 @@ Ox.Map = function(options, self) {
return that; return that;
} }
/*@
setCenter <f> Set map center
(center) -> <o> Map
center <o> Map center
lat <n> Latitude
lng <n> Longitude
@*/
that.setCenter = function(center) {
self.map.setCenter(new google.maps.LatLng(center.lat, center.lng));
return that;
};
/*@ /*@
value <f> value value <f> value
(id, key, value) -> <o> set id, key to value (id, key, value) -> <o> set id, key to value