geoman-io / leaflet-geoman

🍂🗺️ The most powerful leaflet plugin for drawing and editing geometry layers
https://geoman.io
MIT License
2.21k stars 433 forks source link

Change cursor when in draw text mode? #1405

Closed barchambeault-lightbox closed 11 months ago

barchambeault-lightbox commented 12 months ago

When you go into draw mode for lines, polygons, etc., the cursor changes to a crosshair, and there's a vertex circle that follows your crosshair around.

however, when you go into edit mode for Text, the cursor changes to a hand, and there's a vertex circle that follows your hand around. Is there a way to change that hand to something else? what about the vertex circle?

i found this: https://github.com/geoman-io/leaflet-geoman/issues/779, which allows me to change the color of the vertex circle, but i haven't been able to find anything that allows me to change the cursor.

Falke-Design commented 11 months ago

Sorry for the late response.

With #1410 the crosshair cursor will be shown while Text Layer drawing. Also instead of changing the cursor over inline-css the class geoman-draw-cursor will be added then, so the cursor can be overwritten.

A workaround for now:

map.on('pm:drawstart',(e)=>{
    if(e.shape === 'Text'){
        map.getContainer().style.cursor = 'Crosshair';
    }
});
map.on('pm:drawend',(e)=>{
    if(e.shape === 'Text'){
        map.getContainer().style.cursor = '';
    }
});
barchambeault-lightbox commented 11 months ago

@Falke-Design thanks for the response. we ended up doing almost this exact workaround, but using a custom css class with DomUtil.addClass() and DomUtil.removeClass(). nice to hear that there will be a more "correct" way of doing this once that new feature is released. we use the "pro" version, which is behind the "free" version in terms of bug fixes and new features. any idea when the "pro" version will catch up?