Allow setting center from array.

This commit is contained in:
tschaub
2011-10-26 15:22:13 -06:00
parent 415c8f9e0c
commit 75a1a8e119
4 changed files with 42 additions and 3 deletions

View File

@@ -38,6 +38,10 @@ OpenLayers.LonLat = OpenLayers.Class({
* it will be the y coordinate of the map location in your map units.
*/
initialize: function(lon, lat) {
if (OpenLayers.Util.isArray(lon)) {
lat = lon[1];
lon = lon[0];
}
this.lon = OpenLayers.Util.toFloat(lon);
this.lat = OpenLayers.Util.toFloat(lat);
},

View File

@@ -1703,6 +1703,9 @@ OpenLayers.Map = OpenLayers.Class({
* options - {Object}
*/
moveTo: function(lonlat, zoom, options) {
if (!(lonlat instanceof OpenLayers.LonLat)) {
lonlat = new OpenLayers.LonLat(lonlat);
}
if (!options) {
options = {};
}