Skip to content

Instantly share code, notes, and snippets.

@here-devblog-gists
Created October 27, 2016 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save here-devblog-gists/c096ec6015caf22dde0a8be4e9d695c2 to your computer and use it in GitHub Desktop.
Save here-devblog-gists/c096ec6015caf22dde0a8be4e9d695c2 to your computer and use it in GitHub Desktop.
HEREMap.prototype.addMarker = function(coordinates, icon) {
var markerOptions = {};
var icons = {
iceCream: {
url: './images/marker-gelato.svg',
options: {
size: new H.math.Size(26, 34),
anchor: new H.math.Point(14, 34)
}
},
origin: {
url: './images/origin.svg',
options: {
size: new H.math.Size(30, 36),
anchor: new H.math.Point(12, 36)
}
},
destination: {
url: './images/destination.svg',
options: {
size: new H.math.Size(30, 36),
anchor: new H.math.Point(12, 36)
}
}
};
if (icons[icon]) {
markerOptions = {
icon: new H.map.Icon(icons[icon].url, icons[icon].options)
};
}
var marker = new H.map.Marker(coordinates, markerOptions);
this.map.addObject(marker);
return marker;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment