Координаты при инициализации карты

This commit is contained in:
Krivchikov Dmitry 2014-11-20 21:27:47 +03:00
parent df18afd519
commit 4e05436a39
2 changed files with 12 additions and 1 deletions

View File

@ -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();

View File

@ -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);