AdvancedMarkerElement class
google.maps.marker.AdvancedMarkerElement
class
Shows a position on a map. Note that the position must be set for the AdvancedMarkerElement to display.
Custom element:
<gmp-advanced-marker gmp-clickable position="lat,lng" title="string"></gmp-advanced-marker>
This class extends
HTMLElement.
This class implements
AdvancedMarkerElementOptions.
Access by calling const {AdvancedMarkerElement} = await google.maps.importLibrary("marker").
See Libraries in the Maps JavaScript API.
Constructor | |
|---|---|
AdvancedMarkerElement |
AdvancedMarkerElement([options])Parameters:
Creates an AdvancedMarkerElement with the options specified. If a map is specified, the AdvancedMarkerElement is added to the map upon construction. |
Properties | |
|---|---|
collisionBehavior |
Type:
CollisionBehavior optional |
gmpClickable |
Type:
boolean optionalHTML attribute:
|
gmpDraggable |
Type:
boolean optional |
map |
Type:
Map optional |
position |
Type:
LatLng|LatLngLiteral|LatLngAltitude|LatLngAltitudeLiteral optionalHTML attribute:
|
title |
Type:
stringHTML attribute:
|
zIndex |
Type:
number optional |
|
Type:
HTMLElementThis field is read-only. The DOM Element backing the view. |
|
Type:
Node optional |
Methods | |
|---|---|
addEventListener |
addEventListener(type, listener[, options])Parameters:
Return Value:
voidSets up a function that will be called whenever the specified event is delivered to the target. See addEventListener |
addListener |
addListener(eventName, handler)Parameters:
Return Value:
MapsEventListener Resulting event listener.Adds the given listener function to the given event name in the Maps Eventing system. |
removeEventListener |
removeEventListener(type, listener[, options])Parameters:
Return Value:
voidRemoves an event listener previously registered with addEventListener from the target. See removeEventListener. |
Events | |
|---|---|
click |
function(event)Arguments:
This event is fired when the AdvancedMarkerElement element is clicked.Not available with addEventListener() (use gmp-click instead). |
drag |
function(event)Arguments:
This event is repeatedly fired while the user drags the AdvancedMarkerElement.Not available with addEventListener(). |
dragend |
function(event)Arguments:
This event is fired when the user stops dragging the AdvancedMarkerElement.Not available with addEventListener(). |
dragstart |
function(event)Arguments:
This event is fired when the user starts dragging the AdvancedMarkerElement.Not available with addEventListener(). |
|
function(event)Arguments:
This event is fired when the AdvancedMarkerElement element is clicked. Best used with addEventListener() (instead of addListener()). |
AdvancedMarkerElementOptions interface
google.maps.marker.AdvancedMarkerElementOptions
interface
Options for constructing an AdvancedMarkerElement.
Properties | |
|---|---|
collisionBehavior optional |
Type:
CollisionBehavior optionalAn enumeration specifying how an AdvancedMarkerElement should behave when it collides with another AdvancedMarkerElement or with the basemap labels on a vector map. Note: |
content optional |
Type:
Node optionalDefault:
PinElement.elementThe DOM Element backing the visual of an AdvancedMarkerElement. Note: |
|
Type:
boolean optionalDefault:
falseIf true, the AdvancedMarkerElement will be clickable and trigger the gmp-click event, and will be interactive for accessibility purposes (e.g. allowing keyboard navigation via arrow keys). |
gmpDraggable optional |
Type:
boolean optionalDefault:
falseIf true, the AdvancedMarkerElement can be dragged. Note: |
map optional |
Type:
Map optionalMap on which to display the AdvancedMarkerElement. The map is required to display the AdvancedMarkerElement and can be provided by setting AdvancedMarkerElement.map if not provided at the construction. |
position optional |
Type:
LatLng|LatLngLiteral|LatLngAltitude|LatLngAltitudeLiteral optionalSets the AdvancedMarkerElement's position. An AdvancedMarkerElement may be constructed without a position, but will not be displayed until its position is provided - for example, by a user's actions or choices. An AdvancedMarkerElement's position can be provided by setting AdvancedMarkerElement.position if not provided at the construction. Note: |
title optional |
Type:
string optionalRollover text. If provided, an accessibility text (e.g. for use with screen readers) will be added to the AdvancedMarkerElement with the provided value. |
zIndex optional |
Type:
number optionalAll AdvancedMarkerElements are displayed on the map in order of their zIndex, with higher values displaying in front of AdvancedMarkerElements with lower values. By default, AdvancedMarkerElements are displayed according to their vertical position on screen, with lower AdvancedMarkerElements appearing in front of AdvancedMarkerElements farther up the screen. Note that zIndex is also used to help determine relative priority between CollisionBehavior.OPTIONAL_AND_HIDES_LOWER_PRIORITY Advanced Markers. A higher zIndex value indicates higher priority. |
AdvancedMarkerClickEvent class
google.maps.marker.AdvancedMarkerClickEvent
class
This event is created from clicking an Advanced Marker. Access the marker's position with event.target.position.
This class extends
Event.
Access by calling const {AdvancedMarkerClickEvent} = await google.maps.importLibrary("marker").
See Libraries in the Maps JavaScript API.
PinElement class
google.maps.marker.PinElement
class
A PinElement represents a DOM element that consists of a shape and a glyph. The shape has the same balloon style as seen in the default AdvancedMarkerElement. The glyph is an optional DOM element displayed in the balloon shape. A PinElement may have a different aspect ratio depending on its PinElement.scale.
Note: Usage as a Web Component (e.g. usage as an HTMLElement subclass, or via HTML) is not yet supported.
This class extends
HTMLElement.
This class implements
PinElementOptions.
Access by calling const {PinElement} = await google.maps.importLibrary("marker").
See Libraries in the Maps JavaScript API.
Constructor | |
|---|---|
PinElement |
PinElement([options])Parameters:
|
Properties | |
|---|---|
background |
Type:
string optional |
borderColor |
Type:
string optional |
element |
Type:
HTMLElementThis field is read-only. The DOM Element backing the view. |
glyph |
|
glyphColor |
Type:
string optional |
scale |
Type:
number optional |
Methods | |
|---|---|
|
addEventListener(type, listener[, options])Parameters:
Return Value:
voidThis function is not yet available for usage. |
removeEventListener |
removeEventListener(type, listener[, options])Parameters:
Return Value:
voidRemoves an event listener previously registered with addEventListener from the target. See removeEventListener. |
PinElementOptions interface
google.maps.marker.PinElementOptions
interface
Options for creating a PinElement.
Properties | |
|---|---|
background optional |
Type:
string optionalThe background color of the pin shape. Supports any CSS color value. |
borderColor optional |
Type:
string optionalThe border color of the pin shape. Supports any CSS color value. |
glyph optional |
The DOM element displayed in the pin. |
glyphColor optional |
Type:
string optionalThe color of the glyph. Supports any CSS color value. |
scale optional |
Type:
number optionalDefault:
1The scale of the pin. |