Created
October 27, 2016 11:11
-
-
Save here-devblog-gists/c096ec6015caf22dde0a8be4e9d695c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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