Поправил положение иконок на карте

This commit is contained in:
Krivchikov Dmitry 2014-04-14 12:52:38 +04:00
parent f65d1b5afe
commit 2267c208a8
1 changed files with 6 additions and 2 deletions

View File

@ -11,7 +11,7 @@ var im;
function init() { function init() {
myMap = new ymaps.Map("map", { myMap = new ymaps.Map("map", {
center: [ymaps.geolocation.latitude, ymaps.geolocation.longitude], center: [ymaps.geolocation.latitude, ymaps.geolocation.longitude],
zoom: 9, zoom: 12,
behaviors: ['default', 'scrollZoom'] behaviors: ['default', 'scrollZoom']
}); });
@ -46,7 +46,8 @@ function init() {
}, },
{ {
iconImageHref: '/ico/man.png', iconImageHref: '/ico/man.png',
iconImageSize: [32, 37] iconImageSize: [32, 37],
iconImageOffset: [-16, -33],
} }
); );
myMap.geoObjects.add(im); myMap.geoObjects.add(im);
@ -66,6 +67,7 @@ function getPoints()
},{ },{
iconImageHref: data[k]['categoryIcon'], iconImageHref: data[k]['categoryIcon'],
iconImageSize: [32, 37], iconImageSize: [32, 37],
iconImageOffset: [-16, -33],
openEmptyBalloon: true, openEmptyBalloon: true,
balloonCloseButton: false balloonCloseButton: false
}); });
@ -128,6 +130,7 @@ function showMeOnTheMap()
{ {
navigator.geolocation.getCurrentPosition(function(pos) { navigator.geolocation.getCurrentPosition(function(pos) {
im.geometry.setCoordinates([pos.coords.latitude, pos.coords.longitude]); im.geometry.setCoordinates([pos.coords.latitude, pos.coords.longitude]);
myMap.setCenter(im.geometry.getCoordinates());
}); });
myMap.setCenter(im.geometry.getCoordinates()); myMap.setCenter(im.geometry.getCoordinates());
@ -166,6 +169,7 @@ function addPoint()
}, { }, {
iconImageHref: categories[$('#addPointCategoryId').val()].icon, iconImageHref: categories[$('#addPointCategoryId').val()].icon,
iconImageSize: [32, 37], iconImageSize: [32, 37],
iconImageOffset: [-16, -33],
openEmptyBalloon: true, openEmptyBalloon: true,
balloonCloseButton: false balloonCloseButton: false
}); });