Answer the question
In order to leave comments, you need to log in
How to filter Placemarks included in the map view area so that when the balloon is opened, it does not close?
First, a Clusterer is created, to which Placemarks will be added.
The handler is hung on the boundschange event
Ymap.events.add('boundschange', this.handleChange);
const query = ymaps.geoQuery(this.geoPlaceMarks);
const visibleGeoObjects = query.searchInside(mapInstance);
const geoObjectsToRemove = this.geoPlaceMarks.filter(({ properties }) => ids.some(id => id !== properties.get('id')));
const geoObjectsToAdd = this.geoPlaceMarks.filter(({ properties }) => ids.some(id => id === properties.get('id')));
clusterInstance.remove(geoObjectsToRemove);
clusterInstance.add(geoObjectsToAdd);
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