Skip to content

Commit 3a51a1b

Browse files
author
Nina
committed
feature: add max zoom to google options
1 parent 04f40fd commit 3a51a1b

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

src/Map/src/Bridge/Google/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ $googleOptions = (new GoogleOptions())
5454

5555
->gestureHandling(GestureHandling::GREEDY)
5656
->backgroundColor('#f00')
57+
->maxZoom(10)
5758
->doubleClickZoom(true)
5859
->zoomControlOptions(new ZoomControlOptions(
5960
position: ControlPosition::BLOCK_START_INLINE_END,

src/Map/src/Bridge/Google/assets/dist/map_controller.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { LoaderOptions } from '@googlemaps/js-api-loader';
22
import AbstractMapController from '@symfony/ux-map';
33
import type { InfoWindowWithoutPositionDefinition, MarkerDefinition, Point, PolygonDefinition, PolylineDefinition } from '@symfony/ux-map';
4-
type MapOptions = Pick<google.maps.MapOptions, 'mapId' | 'gestureHandling' | 'backgroundColor' | 'disableDoubleClickZoom' | 'zoomControl' | 'zoomControlOptions' | 'mapTypeControl' | 'mapTypeControlOptions' | 'streetViewControl' | 'streetViewControlOptions' | 'fullscreenControl' | 'fullscreenControlOptions'>;
4+
type MapOptions = Pick<google.maps.MapOptions, 'mapId' | 'gestureHandling' | 'backgroundColor' | 'maxZoom' | 'disableDoubleClickZoom' | 'zoomControl' | 'zoomControlOptions' | 'mapTypeControl' | 'mapTypeControlOptions' | 'streetViewControl' | 'streetViewControlOptions' | 'fullscreenControl' | 'fullscreenControlOptions'>;
55
export default class extends AbstractMapController<MapOptions, google.maps.Map, google.maps.marker.AdvancedMarkerElementOptions, google.maps.marker.AdvancedMarkerElement, google.maps.InfoWindowOptions, google.maps.InfoWindow, google.maps.PolygonOptions, google.maps.Polygon, google.maps.PolylineOptions, google.maps.Polyline> {
66
providerOptionsValue: Pick<LoaderOptions, 'apiKey' | 'id' | 'language' | 'region' | 'nonce' | 'retries' | 'url' | 'version' | 'libraries'>;
77
map: google.maps.Map;

src/Map/src/Bridge/Google/assets/src/map_controller.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type MapOptions = Pick<
2323
| 'mapId'
2424
| 'gestureHandling'
2525
| 'backgroundColor'
26+
| 'maxZoom'
2627
| 'disableDoubleClickZoom'
2728
| 'zoomControl'
2829
| 'zoomControlOptions'

src/Map/src/Bridge/Google/src/GoogleOptions.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function __construct(
2727
private ?string $mapId = null,
2828
private GestureHandling $gestureHandling = GestureHandling::AUTO,
2929
private ?string $backgroundColor = null,
30+
private ?int $maxZoom = null,
3031
private bool $disableDoubleClickZoom = false,
3132
private bool $zoomControl = true,
3233
private ZoomControlOptions $zoomControlOptions = new ZoomControlOptions(),
@@ -58,6 +59,13 @@ public function gestureHandling(GestureHandling $gestureHandling): self
5859
return $this;
5960
}
6061

62+
public function maxZoom(?int $maxZoom): self
63+
{
64+
$this->maxZoom = $maxZoom;
65+
66+
return $this;
67+
}
68+
6169
public function backgroundColor(?string $backgroundColor): self
6270
{
6371
$this->backgroundColor = $backgroundColor;
@@ -173,6 +181,7 @@ public function toArray(): array
173181
'mapId' => $this->mapId,
174182
'gestureHandling' => $this->gestureHandling->value,
175183
'backgroundColor' => $this->backgroundColor,
184+
'maxZoom' => $this->maxZoom,
176185
'disableDoubleClickZoom' => $this->disableDoubleClickZoom,
177186
];
178187

src/Map/src/Bridge/Google/tests/GoogleOptionsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function testWithMinimalConfiguration(): void
2727
'mapId' => null,
2828
'gestureHandling' => 'auto',
2929
'backgroundColor' => null,
30+
'maxZoom' => null,
3031
'disableDoubleClickZoom' => false,
3132
'zoomControlOptions' => [
3233
'position' => ControlPosition::INLINE_END_BLOCK_END->value,

0 commit comments

Comments
 (0)