Skip to content

Instantly share code, notes, and snippets.

@mourner
Created July 9, 2012 12:01
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 mourner/3076084 to your computer and use it in GitHub Desktop.
Save mourner/3076084 to your computer and use it in GitHub Desktop.
Leaflet 0.3 -> 0.4 Icon API upgrade
// 0.3 way
var icon = new L.Icon('icon.png');
// 0.4 way
var icon = new L.Icon({iconUrl: 'icon.png'}); // or just "L.icon(...)"
// 0.3 way
var MyIcon = L.Icon.extend({
iconUrl: 'icon.png',
...
});
// 0.4 way
var MyIcon = L.Icon.extend({
options: {
iconUrl: 'icon.png',
...
}
});
// if you need to inherit default marker properties, inherit from L.Icon.Default instead of L.Icon
@mourner
Copy link
Author

mourner commented Jul 9, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment