dosamigos\google\maps\Map::getMarkersFittingZoom PHP Метод

getMarkersFittingZoom() публичный Метод

public getMarkersFittingZoom ( integer $margin, integer $default = 14 ) : integer
$margin integer
$default integer
Результат integer
    public function getMarkersFittingZoom($margin = 0, $default = 14)
    {
        $markers = $this->getMarkers();
        $bounds = LatLngBounds::getBoundsOfMarkers($markers, $margin);
        return $bounds->getZoom(min($this->width, $this->height), $default);
    }

Usage Example

Пример #1
0
 public function flushMap()
 {
     if ($this->autoCenter) {
         if ($LatLonCenter = $this->map->getMarkersCenterCoordinates()) {
             $this->map->setCenter($LatLonCenter);
             $this->map->zoom = $this->map->getMarkersFittingZoom();
         }
     }
 }