Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom tooltip for NavigationControl #9620

Closed
lucasgao opened this issue Apr 23, 2020 · 3 comments
Closed

Custom tooltip for NavigationControl #9620

lucasgao opened this issue Apr 23, 2020 · 3 comments

Comments

@lucasgao
Copy link

Current NavigationControl tooltip is build in Zoom in and Zoom out. Can we support to use custom tooltip text?

@ryanhamley
Copy link
Contributor

Hi @lucasgao #8095 added a way to implement localization of UI strings. This approach is flexible enough to be used to customize the tooltips for control buttons as well. Here's an example of this approach:

var map = window.map = new mapboxgl.Map({
    container: 'map',
    zoom: 12.5,
    center: [-77.01866, 38.888],
    style: 'mapbox://styles/mapbox/streets-v10',
    hash: true,
    locale: {
        'NavigationControl.ZoomIn': 'testing',
        'NavigationControl.ZoomOut': 'foobar'
    }
});

For a full list of customizable strings, see https://github.com/mapbox/mapbox-gl-js/blob/master/src/ui/default_locale.js

@lucasgao
Copy link
Author

thank you @ryanhamley which version supports this?

@ryanhamley
Copy link
Contributor

This was added in v1.6.0

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

No branches or pull requests

2 participants