Answer the question
In order to leave comments, you need to log in
How to pause between adding markers to a 2GIS map?
I want to make a delay between adding markers to a 2gis map in 200ms, tell me how to do this?
Here is the method that creates these markers:
setMarkers(rcs){
rcs.forEach(residential => {
let myDivIcon = DG.divIcon({
iconSize: [30, 30],
className: "marker-custom",
html: this.setMiniMarker(residential)
});
this.popupMap = DG.popup({
className: "test-name",
closeButton: false,
offset: DG.point(0, 1),
setZoomMarker: false
}).setContent(this.setPopupMarker(residential));
this.coordinates = [residential.latitude, residential.longitude];
DG.marker(this.coordinates, { icon: myDivIcon })
.addTo(this.markers)
.bindPopup(this.popupMap);
});
this.markers.addTo(this.map);
this.map.fitBounds(this.markers.getBounds());
this.markers.on("click", event => {
//при наведении.mouseover, click на маркер
if (event.originalEvent.target.closest("[data-id]")) {
let residentialId = Number(
event.originalEvent.target.closest("[data-id]").dataset.id
);
this.setResidentialId(residentialId);
// добавление класса с задержкой для ожидания создания данных
if (this.countFunctionMarker === 0) {
setTimeout(() => (this.isOpenRc = true), 200);
} else {
this.isOpenRc = true;
}
this.countFunctionMarker++;
}
});
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question