Метка (или балун - как правильно?) представляет собой контур здания. При зумировании карты метка не меняет свой размер и непонятно, как убрать с карты элемент "Как добраться?":
var ymaps,lastRoute;
if(typeof ymaps !== 'undefined') {
ymaps.ready(function() {
myMap = new ymaps.Map('map', {
//center: [55.788668, 49.099914],
center: [59.88157957, 30.31588162],
zoom: 16,
//controls: ["zoomControl", "trafficControl", "geolocationControl", "routeEditor", "rulerControl"]
controls: ["geolocationControl"]
});
//doRoute([55.788668, 49.099914]);
// test begin
/*var myPlacemark = new ymaps.Placemark([59.88157957, 30.31566162] , {
hintContent: 'test"'
},
{ iconLayout: 'default#image',
iconImageHref: './img/map-balloon.png',
iconImageSize: [300, 157],
iconImageOffset: [-110, -67] });
myMap.geoObjects.add(myPlacemark);*/
var myPlacemark = new ymaps.Placemark([59.88157957, 30.31566162] , {
hintContent: 'test"'
},
{ iconLayout: 'default#image',
iconImageHref: './img/map-balloon.png',
//iconImageSize: [170, 80],
iconImageSize: [300, 157],
iconImageOffset: [-110, -47] });
myMap.geoObjects.add(myPlacemark);
// test end
});
doRoute = function(pos) {
ymaps.route([
pos,
//[55.779894, 49.128862]
[59.88157957, 30.31566162]
], {
boundedBy: myMap.getBounds(),
mapStateAutoApply: true
}).then(function (route) {
lastRoute = route;
myMap.geoObjects.add(route);
var points = route.getWayPoints(),
lastPoint = points.getLength() - 1,
paths = route.getPaths();
paths.options.set({
strokeColor: '50caef',
strokeWidth: 5,
opacity: 0.9
});
}, function (error) {
alert('Возникла ошибка: ' + error.message);
});
},
removeRoute = function() {
lastRoute && myMap.geoObjects.remove(lastRoute);
};
}
$(document).on('submit', '.enter_address_form', function(e) {
e.preventDefault();
var $form = $(this),
$input = $form.find('[name="address"]'),
address = $input.val();
removeRoute();
doRoute(address);
$input.blur();
return false;
});