MMapCollection
MMapCollection
is a class that can combine multiple objects in a collection. It enables you to add objects to a subtree and remove them from it.
Creating a collection
Example of creating a collection of markers.
vanilla
react
vue
const collection = new MMapCollection({});
const markerElement = document.createElement('div');
markerElement.className = 'marker';
for (let i = 0; i < 10_000; i++) {
collection.addChild(new MMapMarker({
coordinates: [Math.random() * 180, Math.random() * 180]
}, markerElement.cloneNode(true)));
}
map.addChild(collection); // add a collection to the map
map.removeChild(collection); // remove all markers from the map
Constructor
new MMapCollection(props
, options?
)
Constructor parameters
Parameter |
Type |
Description |
|
|
Value of input |
|
Optional parameters. |
Inherited from
new MMapCollection(props
, children?
, options?
)
Constructor parameters
Parameter |
Type |
|
|
|
|
|
|
Inherited from
Props
readonly children: readonly [MMapEntity](MMapEntity.md)<unknown, {}>[]
Inherited from
Methods
addChild
addChild(child
, index
?): MMapCollection
Parameters
Parameter |
Type |
|
|
|
|
Returns
Inherited from
removeChild
removeChild(child
): MMapCollection
Parameters
Parameter |
Type |
|
|
Returns
Inherited from
update
update(changedProps
): void
Parameters
Parameter |
Type |
Description |
|
|
New |
Returns
void