Skip to content

Instantly share code, notes, and snippets.

@Kamapcuc
Last active January 3, 2016 03:29
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Kamapcuc/8402676 to your computer and use it in GitHub Desktop.
<html>
<head>
<script src="http://api-maps.yandex.ru/2.1.4/?lang=ru-RU" type="text/javascript"> </script>
<script type="text/javascript">
var iconSvg = '<svg id="icon" style="position: absolute; z-index:2000; left:-12.5px; top:-31px; width:25px; height:31px"><g style="stroke-width:0; fill-opacity:$[options.opacity]" transform="scale(0.25)">' +
'<path d="M 50 124 l 14.6 -26.2 A 50 50 0 1 0 35.4 97.8" fill="$[options.color]"/><circle cx="50" cy="50" r="36" fill="white"/>' +
'<polygon points="54.5,50.75,66.25,37,52.75,42.5,28.5,37.25" fill="#ed1c24" /><polygon points="44.25,48,75.5,63.75,46,57.75,30.5,64" fill="#005baa"/>' +
'<circle cx="52.75" cy="36.25" r="4.25" fill="#005baa"/></g></svg>';
ymaps.ready(init);
function init () {
var map = new ymaps.Map('map', {
center: [56.8734428213519, 53.2776383043983],
zoom: 10
});
var createMyLayout = function(svg) {
return ymaps.templateLayoutFactory.createClass(svg, {
getShape: function() {
return new ymaps.shape.Circle(new ymaps.geometry.pixel.Circle([0, -18.5], 12.5));
}
});
}
myLayout1 = createMyLayout(iconSvg);
ymaps.option.presetStorage.add('sm#icon1', {
iconLayout : myLayout1,
iconColor: '#005baa'
});
ymaps.option.presetStorage.add('sm#icon2', {
iconLayout : myLayout1,
iconColor: '#ed1c24'
});
placemark = new ymaps.Placemark( [ 56.8734428213519, 53.2776383043983 ] , {
balloonContent : 'test'
}, {
preset: 'sm#icon1'
});
var placemark.events
.add("mouseenter", function () {
placemark.options.set("preset", 'sm#icon2');
})
.add("mouseleave", function () {
placemark.options.set("preset", 'sm#icon1');
});
map.geoObjects.add(placemark);
}
</script>
</head>
<body>
<div id="map" style="width:1000px; height:800px"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment