From 526f66fa241bcf9c96c285b8134fe66a85954dc1 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Sat, 5 Jul 2014 19:35:16 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BA=D0=BE=D1=81=D1=8F=D0=BA=D0=B8=20=D1=81=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BA=D0=B0=D0=B7=D0=BE=D0=BC=20=D0=BF=D0=BE=D0=BF=D0=B0?= =?UTF-8?q?=D0=BF=D0=B0.=20=D0=A2=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D0=BA?= =?UTF-8?q?=D0=B0=D1=80=D1=82=D0=B0=20=D1=81=D0=BC=D0=B5=D1=89=D0=B0=D0=B5?= =?UTF-8?q?=D1=82=D1=81=D1=8F=20=D0=BD=D0=B8=D0=B6=D0=B5=20=D0=BD=D0=B0=20?= =?UTF-8?q?=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D1=82=D1=8C=20=D1=8D=D0=BA?= =?UTF-8?q?=D1=80=D0=B0=D0=BD=D0=B0=20=D0=B8=20=D0=BF=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B2=D0=B0=D1=80=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=BE=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=B1=D0=BB=D0=B8=D0=B6=D0=B0=D0=B5=D1=82?= =?UTF-8?q?=D1=81=D1=8F=20=D0=B4=D0=BE=D1=81=D1=82=D0=B0=D1=82=D0=BE=D1=87?= =?UTF-8?q?=D0=BD=D0=BE,=20=D1=87=D1=82=D0=BE=20=D0=B1=D1=8B=20=D0=BD?= =?UTF-8?q?=D0=BE=D1=80=D0=BC=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BA=D0=B0=D0=B7=D0=B0=D0=BB=D1=81=D1=8F=20=D0=BF=D0=BE=D0=BF?= =?UTF-8?q?=D0=B0=D0=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/map.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/public/js/map.js b/public/js/map.js index 3353ee8..f6cb585 100644 --- a/public/js/map.js +++ b/public/js/map.js @@ -163,6 +163,8 @@ function initPoints() function showInfo(id) { marker = points[id]; + markers.zoomToShowLayer(marker,function() {}); + if (!(id in points) || marker.options.description == undefined) { marker.bindPopup("Загрузка...").openPopup(); @@ -193,12 +195,21 @@ function showInfo(id) marker.options.description = description; 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; }