From f4cdfb334981f9bcf0bd2cfd373483f0eec641d4 Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 1 Sep 2012 13:15:47 +0200 Subject: [PATCH] Ox.Map: add public methods getCenter and setCenter --- source/Ox.UI/js/Map/Map.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/source/Ox.UI/js/Map/Map.js b/source/Ox.UI/js/Map/Map.js index 7ba066f6..6a1c8022 100644 --- a/source/Ox.UI/js/Map/Map.js +++ b/source/Ox.UI/js/Map/Map.js @@ -1476,6 +1476,17 @@ Ox.Map = function(options, self) { addPlaceToPlaces(data); }; + /*@ + getCenter Returns the map center + () -> Map center + lat Latitude + lng Longitude + @*/ + that.getCenter = function() { + var center = self.map.getCenter(); + return {lat: center.lat(), lng: center.lng()}; + }; + /*@ getKey getKey () -> get key @@ -1579,6 +1590,18 @@ Ox.Map = function(options, self) { return that; } + /*@ + setCenter Set map center + (center) -> Map + center Map center + lat Latitude + lng Longitude + @*/ + that.setCenter = function(center) { + self.map.setCenter(new google.maps.LatLng(center.lat, center.lng)); + return that; + }; + /*@ value value (id, key, value) -> set id, key to value