add core functions to create a generic marker icon, of a specified colour.

use it for the new portal distance current location marker, and search result marker
This commit is contained in:
Jon Atkins
2015-02-21 17:08:04 +00:00
parent e03bbf50f1
commit badcdbdb18
3 changed files with 30 additions and 21 deletions

View File

@ -440,6 +440,32 @@ window.clampLatLngBounds = function(bounds) {
return new L.LatLngBounds ( clampLatLng(bounds.getSouthWest()), clampLatLng(bounds.getNorthEast()) );
}
window.getGenericMarkerSvg = function(color) {
var markerTemplate = '@@INCLUDESTRING:images/marker-icon.svg.template@@';
return markerTemplate.replace(/%COLOR%/g, color);
}
window.getGenericMarkerIcon = function(color,className) {
return L.divIcon({
iconSize: new L.Point(25, 41),
iconAnchor: new L.Point(12, 41),
html: getGenericMarkerSvg(color),
className: className || 'leaflet-iitc-divicon-generic-marker'
});
}
window.createGenericMarker = function(ll,color,options) {
options = options || {};
var markerOpt = $.extend({
icon: getGenericMarkerIcon(color || '#a24ac3')
}, options);
return L.marker(ll, markerOpt);
}
// Fix Leaflet: handle touchcancel events in Draggable
L.Draggable.prototype._onDownOrig = L.Draggable.prototype._onDown;