GoogleMap Component
TheGoogleMap component wraps the google.maps.Map class from the Google Maps JavaScript API.
Source: /home/daytona/workspace/source/src/google-maps/google-map/README.md
Basic Usage
Inputs
Size
height(string) - Height of the map (e.g., “400px”, “100%”)width(string) - Width of the map (e.g., “750px”, “100%“)
Map Configuration
center(google.maps.LatLngLiteral | google.maps.LatLng) - Map center positionzoom(number) - Zoom level (0-22, depending on location)options(google.maps.MapOptions) - Full map configuration options
Outputs (Events)
All native Google Maps events are available with a “map” prefix to avoid colliding with native DOM events:Mouse Events
mapClick- User clicks on the mapmapDblclick- User double-clicks on the mapmapRightclick- User right-clicks on the mapmapMousemove- Mouse moves over the mapmapMouseover- Mouse enters the mapmapMouseout- Mouse leaves the map
Map State Events
boundsChanged- Map bounds changecenterChanged- Map center changeszoomChanged- Zoom level changesheadingChanged- Heading changes (for 45° imagery)idle- Map becomes idle after panning/zoomingmapTypeIdChanged- Map type changesprojectionChanged- Projection changestilesloaded- All tiles have loaded
Drag Events
mapDrag- User drags the mapmapDragend- User stops draggingmapDragstart- User starts dragging
Options Object
You can configure the map using agoogle.maps.MapOptions object:
Accessing the Map Instance
You can access the underlyinggoogle.maps.Map instance using ViewChild or viewChild:
Map Types
Google Maps supports different map types:Custom Styling
You can customize the map appearance with styled maps:Responsive Maps
Make maps responsive using percentage-based dimensions:Map Controls
Configure built-in map controls:Common MapOptions
center- Initial center positionzoom- Initial zoom levelmapTypeId- Map type (‘roadmap’, ‘satellite’, ‘hybrid’, ‘terrain’)disableDefaultUI- Hide all default controlszoomControl- Show/hide zoom controlmapTypeControl- Show/hide map type controlstreetViewControl- Show/hide street view controlfullscreenControl- Show/hide fullscreen controlstyles- Custom map stylinggestureHandling- How gestures are handled (‘greedy’, ‘cooperative’, ‘none’, ‘auto’)minZoom- Minimum zoom levelmaxZoom- Maximum zoom levelrestriction- Restrict map bounds