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

How to change the title description of drawMarker #1345

Closed Coding-Journey-Studio closed 7 months ago

Coding-Journey-Studio commented 1 year ago

Forgive me for not finding the relevant documents. How to change the title description of drawMarker

matthewtboyle commented 10 months ago

Assuming that you are wanting to change the tooltip on the drawMarker button? The documentation for this is here: https://www.geoman.io/docs/customize/language

The link to the english translation file is broken, but you can find your various options for strings in the Translations Class at: https://github.com/geoman-io/leaflet-geoman/blob/b8b56e785deea901b94f2d8d683c70130f66327b/leaflet-geoman.d.ts#L581

I think what you want to do is something like the following:

this.customTranslation = { buttonTitles: { drawMarkerButton: 'Your custom text' } }; and this.map.pm.setLang('customName', this.customTranslation, 'en' );

CptHolzschnauz commented 7 months ago

I'm also a bit confused here. With

 map.pm.setGlobalOptions({
                tooltips: false
            });

i still have the tiptools as a mouseover on the toolbar. The tooltips in the map are off as expected. In my case, I want to change the text 'Drag Layers' apearing as mouse over on the Drag tool, but all my tries failed. Is there a hint for me?

CptHolzschnauz commented 7 months ago

For those who found this thread with the same question. Just host geoman.js local and edit the source...

Falke-Design commented 7 months ago

@CptHolzschnauz you can overwrite the tooltip of the control with the same way as @matthewtboyle described, just overwrite the other key: https://github.com/geoman-io/leaflet-geoman/blob/20df292812c207cab3990e58400ec54868c29d8e/src/assets/translations/en.json#L26

this.customTranslation = { buttonTitles: { dragButton: 'Your custom text' } };
this.map.pm.setLang('customName', this.customTranslation, 'en' );

https://jsfiddle.net/1nh5p9v0/