FIX-FIX вроде поправил клики по маркерам и перемещение по истории
This commit is contained in:
parent
ab7c821713
commit
feb28994a9
|
|
@ -160,7 +160,7 @@ function constructPoint(data)
|
|||
[data['lat'], data['lng']], {icon: icon, title: data['name'], id: id, categoryId: data['categoryId']}
|
||||
).on('click', function (e) {
|
||||
if (!(id in pointsSources)) {
|
||||
showInfo(e.target.options.id);
|
||||
showInfo(e.target.options.id, true);
|
||||
} else {
|
||||
history.pushState({pointId: id}, document.title, "/?point=" + e.target.options.id);
|
||||
document.title = e.target.options.title;
|
||||
|
|
@ -213,12 +213,13 @@ function initPoints()
|
|||
* @param {type} id
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
function showInfo(id)
|
||||
function showInfo(id, mapClick)
|
||||
{
|
||||
if (!(id in points)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mapClick = Boolean(mapClick !== undefined && mapClick === true); // true если это клик по маркеру на карте
|
||||
marker = points[id];
|
||||
if (!(id in pointsSources))
|
||||
{
|
||||
|
|
@ -227,15 +228,15 @@ function showInfo(id)
|
|||
url: "/json/point/id/" + id,
|
||||
success: function (data) {
|
||||
pointsSources[id] = data;
|
||||
drawInfoPopup(id)
|
||||
drawInfoPopup(id, true)
|
||||
}
|
||||
});
|
||||
} else {
|
||||
drawInfoPopup(id);
|
||||
drawInfoPopup(id, !mapClick);
|
||||
}
|
||||
}
|
||||
|
||||
function drawInfoPopup(id) {
|
||||
function drawInfoPopup(id, showPopup) {
|
||||
data = pointsSources[id];
|
||||
if (typeof (data.images) == 'object')
|
||||
{
|
||||
|
|
@ -285,12 +286,15 @@ function drawInfoPopup(id) {
|
|||
bounds = myMap.getBounds();
|
||||
diff = (bounds._northEast.lat - bounds._southWest.lat) / 4;
|
||||
myMap.setView([points[id]._latlng.lat + diff, points[id]._latlng.lng], myMap.getZoom());
|
||||
|
||||
if (showPopup) {
|
||||
marker.openPopup();
|
||||
}
|
||||
|
||||
history.pushState({pointId: id}, document.title, "/?point=" + id);
|
||||
document.title = marker.options.title;
|
||||
});
|
||||
window.event.stopPropagation();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue