|
|
L.CustomMarker = L.Marker.extend({ |
|
|
|
|
|
options: { |
|
|
elementCreator: undefined, |
|
|
shadowCreator: undefined, |
|
|
clickable: true, |
|
|
draggable: false |
|
|
}, |
|
|
|
|
|
initialize: function(latlng, options) { |
|
|
|
|
|
options.icon = new L.CustomIcon(options); |
|
|
|
|
|
L.Util.setOptions(this, options); |
|
|
this._latlng = latlng; |
|
|
}, |
|
|
}); |
|
|
|
|
|
L.CustomIcon = L.DivIcon.extend({ |
|
|
options: { |
|
|
elementCreator: function() { |
|
|
return document.createElement('div'); |
|
|
}, |
|
|
shadowCreator: function() { }, |
|
|
className: '', |
|
|
}, |
|
|
|
|
|
initialize: function(options) { |
|
|
L.Util.setOptions(this, options); |
|
|
}, |
|
|
|
|
|
createIcon() { |
|
|
|
|
|
var icon = this.options.elementCreator(), |
|
|
className = icon.className; |
|
|
|
|
|
icon.className += ' leaflet-marker-icon'; |
|
|
|
|
|
return icon; |
|
|
}, |
|
|
|
|
|
createShadow() { |
|
|
return this.options.shadowCreator(); |
|
|
} |
|
|
}); |