2
* Leaflet plugin to create map icons using Maki Icons from MapBox.
5
* Maki Icons: https://www.mapbox.com/maki/
6
* MapBox Marker API: https://www.mapbox.com/developers/api/static/#markers
9
* var icon = L.MakiMarkers.icon({icon: "rocket", color: "#b0b", size: "m"});
12
* MIT: http://jseppi.mit-license.org/
18
// Available Maki Icons
19
icons: ["airfield","airport","alcohol-shop","america-football","art-gallery","bakery","bank","bar",
20
"baseball","basketball","beer","bicycle","building","bus","cafe","camera","campsite","car",
21
"cemetery","chemist","cinema","circle-stroked","circle","city","clothing-store","college",
22
"commercial","cricket","cross","dam","danger","disability","dog-park","embassy",
23
"emergency-telephone","entrance","farm","fast-food","ferry","fire-station","fuel","garden",
24
"golf","grocery","hairdresser","harbor","heart","heliport","hospital","industrial",
25
"land-use","laundry","library","lighthouse","lodging","logging","london-underground",
26
"marker-stroked","marker","minefield","mobilephone","monument","museum","music","oil-well",
27
"park2","park","parking-garage","parking","pharmacy","pitch","place-of-worship",
28
"playground","police","polling-place","post","prison","rail-above","rail-light",
29
"rail-metro","rail-underground","rail","religious-christian","religious-jewish",
30
"religious-muslim","restaurant","roadblock","rocket","school","scooter","shop","skiing",
31
"slaughterhouse","soccer","square-stroked","square","star-stroked","star","suitcase",
32
"swimming","telephone","tennis","theatre","toilets","town-hall","town","triangle-stroked",
33
"triangle","village","warehouse","waste-basket","water","wetland","zoo"
36
defaultIcon: "circle-stroked",
38
apiUrl: "https://api.tiles.mapbox.com/v3/marker/",
53
L.MakiMarkers.Icon = L.Icon.extend({
55
//Maki icon: any from https://www.mapbox.com/maki/ (ref: L.MakiMarkers.icons)
56
icon: L.MakiMarkers.defaultIcon,
57
//Marker color: short or long form hex color code
58
color: L.MakiMarkers.defaultColor,
59
//Marker size: "s" (small), "m" (medium), or "l" (large)
60
size: L.MakiMarkers.defaultSize,
64
className: "maki-marker"
67
initialize: function(options) {
70
options = L.setOptions(this, options);
72
switch (options.size) {
74
L.extend(options, L.MakiMarkers.smallOptions);
77
L.extend(options, L.MakiMarkers.largeOptions);
81
L.extend(options, L.MakiMarkers.mediumOptions);
86
pin = "pin-" + options.size;
88
if (options.icon !== null) {
89
pin += "-" + options.icon;
92
if (options.color !== null) {
93
if (options.color.charAt(0) === "#") {
94
options.color = options.color.substr(1);
97
pin += "+" + options.color;
100
options.iconUrl = "" + L.MakiMarkers.apiUrl + pin + ".png";
101
options.iconRetinaUrl = L.MakiMarkers.apiUrl + pin + "@2x.png";
105
L.MakiMarkers.icon = function(options) {
106
return new L.MakiMarkers.Icon(options);