Skip to content

Conversation

@fgoudreault
Copy link

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)

@emilhe
Copy link
Owner

emilhe commented May 15, 2025

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?

@fgoudreault
Copy link
Author

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants