diff --git a/ground/controllers/IndexController.php b/ground/controllers/IndexController.php index 9ef6f9b..38ac110 100644 --- a/ground/controllers/IndexController.php +++ b/ground/controllers/IndexController.php @@ -64,6 +64,9 @@ class IndexController extends Controller App::setConfig('title', $res['pointsCount'] . ' или даже больше поводов не сидеть дома'); self::addVar('pointsCount', $res['pointsCount']); + self::addVar('pointLat', 0); + self::addVar('pointLng', 0); + if (isset($_GET['point']) && $_GET['point'] && is_numeric($_GET['point'])) { $id = (int) $_GET['point']; @@ -75,6 +78,9 @@ class IndexController extends Controller $point->descriptionHtml .= ' #wikipoints'; $og = Helper::buildOG($point); + + self::addVar('pointLat', $point->lat); + self::addVar('pointLng', $point->lng); } else if (isset($_GET['point']) && $_GET['point'] && strtolower($_GET['point']) == 'random') { $og = array(); diff --git a/public/js/map.js b/public/js/map.js index 37b23db..8b720da 100644 --- a/public/js/map.js +++ b/public/js/map.js @@ -29,7 +29,12 @@ categories.im = L.icon({ ymaps.ready(function () { lat = ymaps.geolocation.latitude; lng = ymaps.geolocation.longitude; - init(lat, lng); + + if (pointLat == pointLng) { + init(lat, lng); + } else { + init(pointLat, pointLng); + } points.im = L.marker([lat, lng], {icon: categories.im, title: 'Вы здесь'}); points.im.addTo(myMap);