ym.modules.provider.Marker
Overview
Used to set markers on the map.
var marker = ym.marker([49, 10]).addTo(map);
Initialization
Factory: ym.layerGroup(latlng, options)
Instantiates a marker object with a geographical point and optionally with further settings.
Parameter
Name | Description | Data type | Default value |
---|---|---|---|
latlng |
[erforderlich] | LatLng |
|
options |
[optional] | Marker-Options |
Parameter: options
Name | Description | Data type | Default value |
---|---|---|---|
icon |
Icon class to be used for rendering the marker | Icon |
|
clickable |
If false, no mouse events are sent. The marker then acts as a part of the underlying map. | bool |
true |
draggable |
Indicates whether the marker can be moved by mouse or touch. | bool |
false |
keyboard |
Indicates whether the marker can be selected with the keyboard and clicked with the Enter key. | bool |
true |
title |
Text for the browser tooltip that is displayed during the hover event (default: no tooltip) | string |
Leere Zeichenfolge |
alt |
Text for the alt attribute of the icon image (useful for accessibility). | string |
Leere Zeichenfolge |
zIndexOffset |
By default, z-Index is automatically set for the marker image based on its width. Use this option if you want to place the marker above or below all others. Specify a high value like 1000 (or a high negative value). | int |
0 |
opacity |
The opacity of the marker. | double |
1.0 |
riseOnHover |
If true, the marker is placed over the others while you move the mouse over it. | bool |
false |
riseOffset |
The z-index offset used for the riseOnHover function. |
int |
250 |
Events
Event | Event object | Description |
---|---|---|
add |
Event |
Is triggered when the marker is added to the map. |
click |
MouseEvent |
Is triggered when the user clicks (or taps) on the marker. |
contextmenu |
MouseEvent |
Is triggered when the user right-clicks on the marker. |
dblclick |
MouseEvent |
Is triggered when the user double-clicks (or double-taps) on the marker. |
drag |
Event |
Is triggered repeatedly while the user pulls the marker. |
dragend |
DragEndEvent |
Is triggered when the user stops dragging the marker. |
dragstart |
Event |
Is triggered when the user starts to drag the marker. |
mousedown |
MouseEvent |
Is triggered when the user presses the mouse button on the marker. |
mouseout |
MouseEvent |
Is triggered when the mouse leaves the selection. |
mouseover |
MouseEvent |
Is triggered when the mouse enters the marker. |
move |
Event |
Is triggered when the marker is moved via setLatLng . New coordinates are added to event arguments. |
popupclose |
PopupEvent |
Is triggered when a popup bound to the marker is closed. |
popupopen |
PopupEvent |
Is triggered when a popup bound to the marker is opened. |
remove |
Event |
Is triggered when the marker is removed from the card. |
Methods
addTo(map) from v3
Adds a marker to the map.
Parameter
Name | Description | Data type | Default value |
---|---|---|---|
map |
Map |
Return
this
getLatLng() from v3
Returns the current geographic position of the marker.
Return
LatLng
setLatLng(latlng) from v3
Changes the position of the marker to the specified point.
Parameter
Name | Description | Data type | Default value |
---|---|---|---|
latlng |
LatLng |
Return
this
setIcon(icon) from v3
Changes the icon of the marker.
Parameter
Name | Description | Data type | Default value |
---|---|---|---|
icon |
Icon |
Return
this
setZIndexOffset(offset) from v3
Changes the z-index offset of the marker.
Parameter
Name | Description | Data type | Default value |
---|---|---|---|
offset |
int |
Return
this
setOpacity(opacity) from v3
Changes the opacity of the marker.
Parameter
Name | Description | Data type | Default value |
---|---|---|---|
opacity |
int |
Return
this
update() from v3
Updates the position of the marker (helpful if the coordinates of the corresponding latLng object were changed directly).
Return
this
bindPopup(html, options) from v3
Binds a popup with a specific HTML content to a click on this marker. You can also open the bound popup with the openPopup
method.
Parameter
Name | Description | Data type | Default value |
---|---|---|---|
html |
string oder HTMLElement oder Popup |
||
options |
[optional] | Popup options |
Return
this
unbindPopup() from v3
Removes the popup previously bound to the marker with bindPopup.
Return
this
openPopup() from v3
Opens the popup previously bound by the bindPopup method.
Return
this
getPopup() from v3
Returns the popup that was previously bound by the bindPopup method.
Return
Popup
closePopup() from v3
Closes the bound marker popup when it is open.
Return
this
togglePopup() from v3
Turns the popup previously bound by the bindPopup method on and off.
Return
this
setPopupContent(html) from v3
Sets an HTML content of the popup of this marker.
Parameter
Name | Description | Data type | Default value |
---|---|---|---|
html |
string oder HTMLElement |
Return
this
toGeoJSON() from v3
Returns a GeoJSON representation of the marker (GeoJSON Point Feature)
Return
Object