> Well, the thing is - if you zoom one level in - you still have all the
> markers on the map.
Aha, I don't see that at all - I can't see the odd "i" marker in China
when zoom in one. I expect it all looks rather different depending on
screensize??
>(or is the api adding some 100px on left and right
> to make sure that the markers are really there?
It's not clear. I don't think it does any padding as such, but it
does do as described in the docs - it sees that the new view
_contains_ bounds. To illustrate - - get the bounds of the current
view, fitBounds on that and the map will zoom out to contain it inside
the new view, and won't stay at the exact same view. But I wonder if
fitBounds is smart enough to avoid on-map controls as well, and works
to place the bounds in an uncluttered map area.
> actually that cannot
> be, because if you click on the airplane icon you will see that 2
> markers are actually not to be seen (the are left behind the status
> bar on the right))
I think that's a timing race in your code, much happens
asynchronously. I can't unravel your code, with so much Mootools &
Hotspots extra scripting with tabs and slidebars, but I'm guessing it
takes time to add the sidebar and then trigger the map resize. While
that's happening the marker data is being fetched AJAX fashion, and
when that is available the fitBounds is performed.
Which will finish first? I think for the bigger "i" markers file the
AJAX takers longer, and things happen in the 'correct' order.
But for the smaller "airplane" data, the fitBounds happens before the
resize. The subsequent resize does not change the maps location/zoom,
nor is it intended to, so the bounds may no longer fit the new smaller
map.
You'll need to enforce a chain of events in sequence I think.
> And also - if the map was showing the same grey space above and below
> the map I wouldn't get that strange feeling that something is wrong.
Is there any reason to expect that the centre of your marker-bounds is
exactly on the equator? The API is doing what you ask of it.
If you want different behaviour, you can make it so. For instance
after doing a fit to bounds, you can write code that checks if the
zoom level is zero and forces a recentre about the equator so that it
looks nice. Or perhaps more 'correct', examine the north and south
limits in view, and if outside the known map (+/-85 latitude ish),
reposition. Or you could examine the bounds yourself, avoid using
fitBounds altogether as the results displease, and calculate yourself
what to do with it.
The API is flexible.