ym.modules.provider.FeatureGroup
Overview
Extended layerGroup
, which also contains mouse events (triggered by members of the group) and a common bindPopup
method. Implements the ILayer
interface.
ym.featureGroup([marker1, marker2, polyline])
.bindPopup('Hello world!')
.on('click', function( ) { alert('Clicked on a group!'); })
.addTo(map);
Initialization
Factory: ym.featureGroup(layers)
Parameter
Name | Description | Data type | Default value |
---|---|---|---|
layers |
The initial set of layers. [optional] | ILayer[] |
Methods
bindPopup(htmlContent, options) ab v3
Binds a popup with a specific HTML content to a click on any level in the group that has a bindPopup
method.
Parameters
Name | Beschreibung | Datentyp | Standardwert |
---|---|---|---|
htmlContent |
string |
||
options |
[optional] |
Return
this
getBounds() ab v3
Returns the LatLngBounds of the feature group, created from the boundaries and coordinates of its children.
Return
LatLngBounds
setStyle(style) ab v3
Sets the specified path options for each level of the group that has a setStyle
method.
Parameter
Name | Beschreibung | Datentyp | Standardwert |
---|---|---|---|
style |
Return
this
bringToFront() ab v3
Brings the layer group to the top edge of all other layers.
Return
this
bringToBack() ab v3
Brings the layer group to the bottom edge of all other layers.
Return
this
Events
You can react to the following events.
Event | Event type | Description |
---|---|---|
click |
MouseEvent | Is triggered when the user clicks (or taps) on the group. |
dblclick |
MouseEvent | Is triggered when the user double-clicks (or double-taps) on the group. |
mouseover |
MouseEvent | Is triggered when the mouse pointer moves over the group. |
mouseout |
MouseEvent | Is triggered when the mouse pointer moves out of the group. |
mousemove |
MouseEvent | Is triggered while the mouse is moved over the layers of the group. |
contextmenu |
MouseEvent | Is triggered when the user right-clicks on one of the layers. |
layeradd |
LayerEvent | Is triggered when a layer is added to the group. |
layerremove |
LayerEvent | Is triggered when a layer is removed from the group. |