modestmaps / modestmaps-js

Modest Maps javascript port
http://modestmaps.com
395 stars 73 forks source link

Simplify setting pan limits #36

Open ansis opened 12 years ago

ansis commented 12 years ago

Would it be appropriate to add map.setPanLimits? In a way, it would be the other half of map.setZoomRange.

Something like:

    setPanLimits: function(locations) {
        if (locations instanceof MM.Extent) {
            locations = locations.toArray();
        }
        this.coordLimits = [
            locations[0].zoomTo(this.coordLimits[0].zoom), 
            locations[1].zoomTo(this.coordLimits[1].zoom) 
        ];
        return this;
    }