mapbox-gl-js icon indicating copy to clipboard operation
mapbox-gl-js copied to clipboard

Disabling transition for text on MapBox

Open adi-darachi opened this issue 8 years ago • 5 comments

I'm using clusters in my map, and the numbers (text) inside the cluster circle (like in the mapbox example https://www.mapbox.com/mapbox-gl-js/example/cluster/).

Each time the cluster number is being updated, (We have moving features) the number (text) inside the cluster is fading in and out.

I'm trying to disable this tranistion using the following settings without success.

Thanks in advance.

` paint: {

            "text-opacity": 1,
            "text-opacity-transition": {
                "duration": 0
            }

        }`

adi-darachi avatar May 29 '18 16:05 adi-darachi

the number (text) inside the cluster is fading in and out

Maybe this is a label fade-in and not a transition, more information here:

https://github.com/mapbox/mapbox-gl-js/issues/6694 https://github.com/mapbox/mapbox-gl-js/pull/6702 https://github.com/mapbox/mapbox-gl-js/issues/6519#issuecomment-390001993

pathmapper avatar May 29 '18 17:05 pathmapper

yes what you're seeing is labels fading in – to disable this behavior in advance of a more long-term fix (#6692) you can use text-allow-overlap: true

mollymerp avatar May 29 '18 17:05 mollymerp

Worked like a charm! Thanks

adi-darachi avatar May 29 '18 18:05 adi-darachi

FYI. Was able to correct label fading in using the fadeDuration map option to lower the default value. This works very well for this 'blinking issue' with labels that are associated with moving/updating data source. Documented here: https://docs.mapbox.com/mapbox-gl-js/api/map/

cdavis4 avatar Feb 11 '21 21:02 cdavis4

FYI. Was able to correct label fading in using the fadeDuration map option to lower the default value. This works very well for this 'blinking issue' with labels that are associated with moving/updating data source. Documented here: https://docs.mapbox.com/mapbox-gl-js/api/map/

Nice find! This should almost be the default behavior

seanhuggins1 avatar Apr 14 '22 23:04 seanhuggins1