From feb28994a92079edadc5f964697bd1f658127d4a Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Thu, 4 Jun 2015 13:31:34 +0300 Subject: [PATCH] =?UTF-8?q?=20FIX-FIX=20=D0=B2=D1=80=D0=BE=D0=B4=D0=B5=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=20=D0=BA=D0=BB?= =?UTF-8?q?=D0=B8=D0=BA=D0=B8=20=D0=BF=D0=BE=20=D0=BC=D0=B0=D1=80=D0=BA?= =?UTF-8?q?=D0=B5=D1=80=D0=B0=D0=BC=20=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=BC=D0=B5=D1=89=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BE=20?= =?UTF-8?q?=D0=B8=D1=81=D1=82=D0=BE=D1=80=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/map.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/public/js/map.js b/public/js/map.js index 5ae3738..6925494 100644 --- a/public/js/map.js +++ b/public/js/map.js @@ -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()); - marker.openPopup(); + + if (showPopup) { + marker.openPopup(); + } history.pushState({pointId: id}, document.title, "/?point=" + id); document.title = marker.options.title; }); - window.event.stopPropagation(); + return true; }