Esa's Google Maps API experiments. |
GMap2.showBounds(bounds, paddings)It is a common practice to form a GLatLngBounds() of all the markers. GMap2.getBoundsZoomLevel(bounds) and bounds.getCenter() are usually applied for setting the viewport. Sometimes the northmost markers partially hide above the viewport. Also the westmost markers often lay under the zoom slider. A method with optional padding parameters was created. Usage:
A virtual viewport is formed by reducing given paddings from the map viewport. The method calculates and performs zooming and centering based on that virtual viewport. Try dragging the markers around. This demo illustrates the virtual viewport as a GPolygon just to visualise the method. If you need just the returned bounds but don't want any zooming and recentering, set GLatLngBounds.drawBox() methodUsed on this page for drawing the bounds box. Returns a GPolyline or GPolygon from the bounds. Usage:
The single optional parameter is an object with GPolygon style properties.
|
|
|
|
||
|
|
||