I created a customized marker for leaflet locate control and inserted it with this code
/*button to turn on GPS*/
//function from leaflet locate control (plugin)
L.Control.locategpsmarker = L.Control.Locate.extend({
_drawMarker: function () {
var icongpsMarker = {
iconUrl: 'img2/gps_marker.png',
iconAnchor: [18, 18]};
var startMarker = L.marker(e.latlng, { icon: L.icon(icongpsMarker) });
startMarker.addTo(mymap);
}
});
/*add geolocation button to map*/
var lc = new L.Control.locategpsmarker({
initialZoomLevel: 13,
locateOptions: { enableHighAccuracy: true },
position: 'topright',
drawCircle: false,
showPopup: false,
});
mymap.addControl(lc);
/*END GEOLOCATION BUTTON*/
and got this error for the customized marker
Uncaught ReferenceError: e is not defined
at i._drawMarker (main.html:119:44)
at i._onLocationFound (L.Control.Locate.js:772:12)
at i.fire (Events.js:190:11)
at i._handleGeolocationResponse (Map.js:729:8)
_drawMarker @ main.html:119
_onLocationFound @ L.Control.Locate.js:772
fire @ Events.js:190
_handleGeolocationResponse @ Map.js:729
Has anybody already put a customized marker to this plugin?