bradcornford / Googlmapper

An easy way to integrate Google Maps with Laravel
MIT License
464 stars 142 forks source link

How to change size of svg icon from db? #316

Closed gidaban closed 5 years ago

gidaban commented 5 years ago

Hello guys,

So far everything working fine except size of my SVG icon.

my code:

 Mapper::map($map->latitude, $map->longitude, [
            'zoom' => 14,
            'fullscreenControl' => false,
            'center' => true,
            'marker' => false,
            'cluster' => false,
            'language' => 'en',
            'markers' => [
                'animation' => 'DROP',
            ]
        ]);

        Mapper::informationWindow($map->latitude, $map->longitude, $map->title,
            [
                'maxWidth' => 300,
                'title' => $map->title,
                'icon' => '/' . $map->category->icon->path,
            ]
        );

Icon is visible but is to large i need to make smaller. Any ideas how i can scale ?

bradcornford commented 5 years ago

Hi,

An icon can be sized in a few ways, the first is by scale, using the following options:

Mapper::informationWindow($map->latitude, $map->longitude, $map->title,
            [
                'maxWidth' => 300,
                'title' => $map->title,
                'icon' => [
                    'url' => '/' . $map->category->icon->path,
                    'size' => 10
                 ]
            ]
        );

The second is by x/y scale, using the following options:

Mapper::informationWindow($map->latitude, $map->longitude, $map->title,
            [
                'maxWidth' => 300,
                'title' => $map->title,
                'icon' => [
                    'url' => '/' . $map->category->icon->path,
                    'size' => [10, 5]
                 ]
            ]
        );
gidaban commented 5 years ago

Thanks :)