CloudMade/Leaflet — Issue #534: drawing custom icon fails
Author: appelflap
Created: 2012-02-24 17:32:28+00:00
State: open

What is the latest official way to extend an icon and add it to the map? The way described on the [examples page](http://leaflet.cloudmade.com/examples/custom-icons.html) does not work anymore in the current master. I get the following error because the icon is only the extended part... it is missing the inheritance.
`TypeError: options.icon.createIcon is not a function`

I now create icons this way.. which does work, but I do not favour it..

``` javascript
var thisIcon = new L.Icon();

thisIcon.options.iconUrl = '/public/images/marker.png';
thisIcon.options.iconAnchor	= new L.Point(16, 16),
thisIcon.options.iconSize	= new L.Point(newWidth, 32);
thisIcon.options.size	= new L.Point(newWidth, 32);
thisIcon.options.shadowUrl	= '/public/images/shadow.png';
thisIcon.options.shadowSize = new L.Point(newWidth+16, 32);
var thisMarker = new L.Marker(new L.LatLng(52.028898, 5.141505), {icon: thisIcon});
map.addLayer(thisMarker);
```