Небольшой кусок кода из js объекта.
После инициализации карты вызывается метод объекта.
Устанавливает карту в центр по координатам выбранной точки
далее по id точки берет состояние объекта в objectManager
[spoiler]
И открывает кастомный попап для точки либо для нескольких точек если вернулся isClusterd == true;
Само собой при вбросе точек (point) в objectManager у них должны быть заданы id
let point = {
type: 'Feature',
id: elem.id,
index: index,
pointType: elem.courier,
pointCourier: elem.courier,
geometry:{
type: 'Point',
coordinates: [parseFloat(elem.geo_location.lat), parseFloat(elem.geo_location.lon)],
},
options:{
iconLayout: 'default#image',
iconImageHref: elem.icon,
},
getPId: function () {
return this.id;
},
getPIndex: function(){
return this.index;
},
};
setActivityPoint: function (index) {
let object = this;
this.map.setCenter([parseFloat(this.points[index].geo_location.lat),parseFloat(this.points[index].geo_location.lon)], 21, {
duration: 500,
checkZoomRange: true
}).then(function () {
let findObject = object.objectManager.getObjectState(object.points[index].id);
if(findObject.found){
findObject.isClustered && object.showBaloon(findObject.cluster.features, object.points[index].id);
findObject.isClustered || object.showBaloon(object.objectManager.objects.getById(object.points[index].id), true);
}
});
},
|