Исправил косяки с показом попапа. Теперь карта смещается ниже на четверть экрана и предварительно приближается достаточно, что бы нормально показался попап
This commit is contained in:
parent
44fe06b41d
commit
526f66fa24
|
|
@ -163,6 +163,8 @@ function initPoints()
|
||||||
function showInfo(id)
|
function showInfo(id)
|
||||||
{
|
{
|
||||||
marker = points[id];
|
marker = points[id];
|
||||||
|
markers.zoomToShowLayer(marker,function() {});
|
||||||
|
|
||||||
if (!(id in points) || marker.options.description == undefined)
|
if (!(id in points) || marker.options.description == undefined)
|
||||||
{
|
{
|
||||||
marker.bindPopup("Загрузка...").openPopup();
|
marker.bindPopup("Загрузка...").openPopup();
|
||||||
|
|
@ -193,12 +195,21 @@ function showInfo(id)
|
||||||
|
|
||||||
marker.options.description = description;
|
marker.options.description = description;
|
||||||
marker.bindPopup(marker.options.description, {maxWidth: 500, maxHeight: 300}).openPopup();
|
marker.bindPopup(marker.options.description, {maxWidth: 500, maxHeight: 300}).openPopup();
|
||||||
|
|
||||||
|
bounds = myMap.getBounds();
|
||||||
|
diff = (bounds._northEast.lat - bounds._southWest.lat)/4;
|
||||||
|
myMap.setView([points[id]._latlng.lat+diff, points[id]._latlng.lng], myMap.getZoom());
|
||||||
|
|
||||||
|
history.pushState({}, document.title, "/?point=" + id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
|
bounds = myMap.getBounds();
|
||||||
|
diff = (bounds._northEast.lat - bounds._southWest.lat)/4;
|
||||||
|
myMap.setView([points[id]._latlng.lat+diff, points[id]._latlng.lng], myMap.getZoom());
|
||||||
|
|
||||||
myMap.setView(points[id]._latlng, myMap.getZoom());
|
history.pushState({}, document.title, "/?point=" + id);
|
||||||
history.pushState({}, document.title, "/?point=" + id);
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue