Created
July 9, 2012 12:01
-
-
Save mourner/3076084 to your computer and use it in GitHub Desktop.
Leaflet 0.3 -> 0.4 Icon API upgrade
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
// 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(...)" |
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
// 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See the changelog for more info: https://github.com/CloudMade/Leaflet/blob/master/CHANGELOG.md