Closed (works as designed)
Project:
Mapstraction
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
5 Nov 2009 at 20:35 UTC
Updated:
4 Jun 2010 at 16:19 UTC
This is a follow-up to #437644: Set initial point dynamically.
I want the map to auto-center, but I would still like to set the Zoom level. This requires a JS change that I don't quite comprehend, and removing the #processing dependency on the zoom form item.
Comments
Comment #1
levelos commentedauto centering and zoom is actually one step in the Mapstraction library. If you think about it, the zoom is simply set to allow all the points to fit in the map when you autocenter.
Comment #2
chrsnlsn commentedTo resolve the problem of auto zooming in too far when there is just one point to display on the map you can add this bit of code to the mapstraction core js file mxn.core.js in the function that handles the auto centering and zoom at the end of the autoCenterAndZoom function before the bounding box is set. You can adjust the '.002' to whatever you desire for a minimum zoom level to start with.
add this
if(lat_min == lat_max){
lat_max = (lat_max+.002);
lon_max = (lon_max+.002);
lat_min = (lat_min-.002);
lon_min = (lon_min-.002);
}
before this
this.setBounds( new BoundingBox(lat_min, lon_min, lat_max, lon_max) );
around line 750 in mxn.core.js