Adding dynamic tooltip text
Hi, i use leaflet.draw plugin to add some shapes to map, but i need to change the information (static text) of the tooltip when the user move the cursor (mousemove) on edit mode or on adding some vertex. How can i intercept this event, something like
map.on('draw:cursor-move', function (e, latlng, options) { .... })
Also, I tried to extend the update text function and update position, but i need also the mousemove event, action or shape type and the latlng position.
Looks like those strings are defined here, so you could update them with e.g.
L.drawLocal.draw.handlers.polygon.tooltip.start = "<your text here>";
drawLocal is documented -- though not it's entire structure -- so it seems to me there's a chance this could break in a future release.
Polyline errors allow us to add HTML content, which is unfortunately not the case with tooltips:
polyline: {
error: '<strong>Error:</strong> shape edges cannot cross!',
tooltip: {
start: 'Click to start drawing line.',
cont: 'Click to continue drawing line.',
end: 'Click last point to finish line.'
}
},