Browse files

Expose extent to coordinate conversion

  • Loading branch information...
1 parent 32cd691 commit cfdf2631943259f236259b0b26466bbd5aa5a2e2 @ansis ansis committed Apr 30, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/map.js
View
7 src/map.js
@@ -216,7 +216,7 @@
return this;
},
- setExtent: function(locations, precise) {
+ extentCoordinate: function(locations, precise) {
// coerce locations to an array if it's a Extent instance
if (locations instanceof MM.Extent) {
locations = locations.toArray();
@@ -271,8 +271,11 @@
var centerRow = (TL.row + BR.row) / 2;
var centerColumn = (TL.column + BR.column) / 2;
var centerZoom = TL.zoom;
+ return new MM.Coordinate(centerRow, centerColumn, centerZoom).zoomTo(initZoom);
+ },
- this.coordinate = new MM.Coordinate(centerRow, centerColumn, centerZoom).zoomTo(initZoom);
+ setExtent: function(locations, precise) {
+ this.coordinate = this.extentCoordinate(locations, precise);
this.draw(); // draw calls enforceLimits
// (if you switch to getFrame, call enforceLimits first)

0 comments on commit cfdf263

Please sign in to comment.