Commit 1d171336 authored by Yuri Bondarenko's avatar Yuri Bondarenko

up

parent f50b9dfa
......@@ -105,11 +105,11 @@ export default class msMap {
console.log("Fetch map data: ", data);
let id = 1;
data.data.map.layers.forEach(function(layer) {
data.data.map.layers.forEach(layer => {
let points = [];
let id2 = 1;
layer.points.forEach(function(point) {
layer.points.forEach(point => {
if (!point) return;
points.push({
......@@ -142,11 +142,11 @@ export default class msMap {
// data_points.items.push(data_points.items[0]);
// data_points.items = data_points.items.slice(1, 5);
this.dataPoints.items.forEach(function(layer) {
/* this.dataPoints.items.forEach(layer => {
let liNode = document.createElement("li");
liNode.innerText = layer.title;
document.querySelector(".ms-map__places").appendChild(liNode);
});
}); */
});
}
......@@ -188,7 +188,7 @@ export default class msMap {
this.dataPoints.items.forEach(layer => {
// Группы точек
this.clusterObjects[layer.title] = [];
clusterObjects[layer.id] = [];
layer.points.forEach(point => {
//console.log(point);
......@@ -226,9 +226,9 @@ export default class msMap {
}
);
marker.events.add("click", async () => {
/* marker.events.add("click", async () => {
for (var keyLayer in clusterObjects) {
clusterObjects[keyLayer].forEach(function(point) {
clusterObjects[keyLayer].forEach(point => {
point.options.set({
iconImageHref: this.basePathPin,
iconImageSize: [30, 30],
......@@ -318,7 +318,7 @@ export default class msMap {
document.querySelector(".ms-map__close").style.display = "block";
if (window.matchMedia("(max-width: 640px)").matches) {
/* mobile */
// mobile
if (this.isEventVisible) {
if (this.popup) {
this.popup.destroy(true);
......@@ -326,26 +326,26 @@ export default class msMap {
this.isEventVisible = false;
}
} else {
/* global lightGallery */
// global lightGallery
this.popup = lightGallery(document.getElementById("map-event"));
this.isEventVisible = true;
}
} else {
/* desktop */
// desktop
if (this.isEventVisible) {
document.querySelector(".ms-map__event").style.display = "none";
} else {
document.querySelector(".ms-map__event").style.display = "block";
}
}
});
});*/
this.clusterObjects[layer.title].push(marker);
clusterObjects[layer.id].push(marker);
this.clusterer.add(marker);
});
this.map.geoObjects.add(this.clusterer);
this.objectManager.add(this.clusterObjects);
/* this.map.geoObjects.add(this.clusterer);
this.objectManager.add(clusterObjects); */
});
// удаляем лишние контролы
......@@ -364,14 +364,14 @@ export default class msMap {
this.map.behaviors.disable(["scrollZoom"]);
// автомасштаб
this.map
/* this.map
.setBounds(this.clusterer.getBounds(), {
checkZoomRange: true,
zoomMargin: [20, 20, 20, 20]
})
.then(function() {
//if( map.getZoom() > 15) map.setZoom(15);
});
}); */
});
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment