AdvancedMarkerElement class
google.maps.marker.AdvancedMarkerElement
class
Shows a position on a map. Note that theposition
must be set for theAdvancedMarkerElement
to display.
Note:Usage as a Web Component (e.g. using the custom<gmp-advanced-marker>
HTML element, is only available in thev=beta
channel).
Custom element:
<gmp-advanced-marker position= "lat,lng" title= "string" ></gmp-advanced-marker>
This class extends
HTMLElement
.
This class implements
AdvancedMarkerElementOptions
.
Access by callingconst {AdvancedMarkerElement} = await google.maps.importLibrary( "marker" )
.SeeLibraries in the Maps JavaScript API.
Constructor | |
---|---|
AdvancedMarkerElement |
AdvancedMarkerElement([options]) Parameters:
Creates an AdvancedMarkerElement with the options specified. If a map is specified, theAdvancedMarkerElement is added to the map upon construction. |
Properties | |
---|---|
collisionBehavior |
Type:
CollisionBehavioroptional |
content |
Type:
Nodeoptional |
element |
Type:
HTMLElement This field is read-only. The DOM Element backing the view. |
gmpDraggable |
Type:
booleanoptional |
map |
Type:
Mapoptional |
position |
Type:
LatLng|LatLngLiteral|LatLngAltitude|LatLngAltitudeLiteraloptional HTML attribute:
|
title |
Type:
string HTML attribute:
|
zIndex |
Type:
numberoptional |
Methods | |
---|---|
addEventListener |
addEventListener(type, listener[, options]) Parameters:
Return Value:
void Sets up a function that will be called whenever the specified event is delivered to the target. SeeaddEventListener |
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:
void Removes an event listener previously registered with addEventListener from the target. SeeremoveEventListener |
Events | |
---|---|
click |
function(event) Arguments:
This event is fired when the AdvancedMarkerElement element is clicked.Not available with addEventListener() (usegmp-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() . |
gmp-click |
function(event) Arguments:
This event is fired when the AdvancedMarkerElement element is clicked. Best used withaddEventListener() (instead ofaddListener() ). |
AdvancedMarkerElementOptions interface
google.maps.marker.AdvancedMarkerElementOptions
interface
Options for constructing anAdvancedMarkerElement
.
Properties | |
---|---|
collisionBehavioroptional |
Type:
CollisionBehavioroptional An enumeration specifying how an AdvancedMarkerElement should behave when it collides with anotherAdvancedMarkerElement or with the basemap labels on a vector map.Note: |
contentoptional |
Type:
Nodeoptional Default:
PinElement.element The DOM Element backing the visual of an AdvancedMarkerElement .Note: |
gmpDraggableoptional |
Type:
booleanoptional Default:
false If true ,theAdvancedMarkerElement can be dragged.Note: |
mapoptional |
Type:
Mapoptional Map on which to display the AdvancedMarkerElement .The map is required to display theAdvancedMarkerElement and can be provided by settingAdvancedMarkerElement.map if not provided at the construction. |
positionoptional |
Type:
LatLng|LatLngLiteral|LatLngAltitude|LatLngAltitudeLiteraloptional Sets the AdvancedMarkerElement 's position. AnAdvancedMarkerElement 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. AnAdvancedMarkerElement 's position can be provided by settingAdvancedMarkerElement.position if not provided at the construction.Note: |
titleoptional |
Type:
stringoptional Rollover text. If provided, an accessibility text (e.g. for use with screen readers) will be added to the AdvancedMarkerElement with the provided value. |
zIndexoptional |
Type:
numberoptional All AdvancedMarkerElement s are displayed on the map in order of their zIndex, with higher values displaying in front ofAdvancedMarkerElement s with lower values. By default,AdvancedMarkerElement s are displayed according to their vertical position on screen, with lowerAdvancedMarkerElement s appearing in front ofAdvancedMarkerElement s farther up the screen. Note thatzIndex is also used to help determine relative priority betweenCollisionBehavior.OPTIONAL_AND_HIDES_LOWER_PRIORITY Advanced Markers. A higherzIndex 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 withevent.target.position
.
This class extends
Event
.
Access by callingconst {AdvancedMarkerClickEvent} = await google.maps.importLibrary( "marker" )
.SeeLibraries in the Maps JavaScript API.
PinElement class
google.maps.marker.PinElement
class
APinElement
represents a DOM element that consists of a shape and a glyph. The shape has the same balloon style as seen in the defaultAdvancedMarkerElement
.The glyph is an optional DOM element displayed in the balloon shape. APinElement
may have a different aspect ratio depending on itsPinElement.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 callingconst {PinElement} = await google.maps.importLibrary( "marker" )
.SeeLibraries in the Maps JavaScript API.
Constructor | |
---|---|
PinElement |
PinElement([options]) Parameters:
|
Properties | |
---|---|
background |
Type:
stringoptional |
borderColor |
Type:
stringoptional |
element |
Type:
HTMLElement This field is read-only. The DOM Element backing the view. |
glyph |
|
glyphColor |
Type:
stringoptional |
scale |
Type:
numberoptional |
Methods | |
---|---|
addEventListener |
addEventListener(type, listener[, options]) Parameters:
Return Value:
void This function is not yet available for usage. |
removeEventListener |
removeEventListener(type, listener[, options]) Parameters:
Return Value:
void Removes an event listener previously registered with addEventListener from the target. SeeremoveEventListener |
PinElementOptions interface
google.maps.marker.PinElementOptions
interface
Options for creating aPinElement
.
Properties | |
---|---|
backgroundoptional |
Type:
stringoptional The background color of the pin shape. Supports any CSScolor value. |
borderColoroptional |
Type:
stringoptional The border color of the pin shape. Supports any CSScolor value. |
glyphoptional |
The DOM element displayed in the pin. |
glyphColoroptional |
Type:
stringoptional The color of the glyph. Supports any CSScolor value. |
scaleoptional |
Type:
numberoptional Default:
1 The scale of the pin. |