dash-leaflet icon indicating copy to clipboard operation
dash-leaflet copied to clipboard

allow custom toolbar tooltips on EditControl component

Open fgoudreault opened this issue 9 months ago • 2 comments

I'd like to propose a new option to the EditControl component which allows to customize the tooltip shown when hovering on the draw buttons. Here's an example screenshot of what it looks like. image

MWE:

from dash import Dash
import dash_leaflet as dl


app = Dash()
app.layout = [
        dl.Map(
            [
                dl.TileLayer(),
                dl.FeatureGroup(
                    [
                        dl.EditControl(
                            buttons={
                                "rectangle": "new tooltip",
                            },
                        ),
                    ],
                ),
            ],
            center=[56, 10], zoom=6, style={"height": "50vh"},
        )
        ]

if __name__ == "__main__":
    app.run(debug=True)

fgoudreault avatar Mar 28 '25 14:03 fgoudreault

This is a nice addition. And a neat PR. One question; is there a reason you only target the buttons property (there's are more, e.g. undo)? Or is it just the one needed for you use case?

emilhe avatar May 15 '25 17:05 emilhe

No particular reasons. I was just looking at these tooltips for my use case. Indeed I guess there could be options for all buttons and one could possibly override the whole L.drawLocal object to change any default tooltips. But then, doing so could create a very complex argument to the function or there could be several new arguments such as the one I am proposing here. I'd be happy to modify the approach if you think this should be a worthy addition :)

fgoudreault avatar Jun 04 '25 11:06 fgoudreault