geoman-io / leaflet-geoman

🍂🗺️ The most powerful leaflet plugin for drawing and editing geometry layers

Home Page:https://geoman.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change cursor when in draw text mode?

barchambeault-edr opened this issue · comments

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: #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.

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 = '';
    }
});

@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?