ADD возможность добавлять себя в маршрут

This commit is contained in:
Krivchikov Dmitry 2014-05-03 22:12:03 +04:00
parent d3c11faed2
commit 4b4514d559
1 changed files with 10 additions and 7 deletions

View File

@ -6,7 +6,6 @@ ymaps.ready(init);
var myMap; var myMap;
var categories; var categories;
var points = Array(); var points = Array();
var im;
var search; var search;
var route = false; var route = false;
@ -56,11 +55,15 @@ function init() {
} }
}); });
im = new ymaps.Placemark( points.im = new ymaps.Placemark(
[ymaps.geolocation.latitude, ymaps.geolocation.longitude], [ymaps.geolocation.latitude, ymaps.geolocation.longitude],
{ {
balloonContentHeader: 'Вы здесь', balloonContentHeader: 'Вы здесь',
balloonContent: '' hintContent: 'Ваше местоположение',
balloonContent:
'<button type="button" class="btn btn-default btn-xs" onclick="addToRoute(\'im\')">' +
'<span class="glyphicon glyphicon-plus"></span> Добавить в маршрут' +
'</button>'
}, },
{ {
iconImageHref: '/ico/man.png', iconImageHref: '/ico/man.png',
@ -68,7 +71,7 @@ function init() {
iconImageOffset: [-16, -33], iconImageOffset: [-16, -33],
} }
); );
myMap.geoObjects.add(im); myMap.geoObjects.add(points.im);
$("#wayPoints").sortable(); $("#wayPoints").sortable();
$("#wayPoints").disableSelection(); $("#wayPoints").disableSelection();
@ -180,11 +183,11 @@ function searchAdderess()
function showMeOnTheMap() function showMeOnTheMap()
{ {
navigator.geolocation.getCurrentPosition(function(pos) { navigator.geolocation.getCurrentPosition(function(pos) {
im.geometry.setCoordinates([pos.coords.latitude, pos.coords.longitude]); points.im.geometry.setCoordinates([pos.coords.latitude, pos.coords.longitude]);
myMap.setCenter(im.geometry.getCoordinates()); myMap.setCenter(points.im.geometry.getCoordinates());
}); });
myMap.setCenter(im.geometry.getCoordinates()); myMap.setCenter(points.im.geometry.getCoordinates());
} }
function activateAddPoint() function activateAddPoint()