mapbox / mapbox/mapbox-gl-js

Implement fading for features that hit minzoom/maxzoom limits

Open
#5,726 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature :green_apple:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

The isHidden() method of StyleLayer prevents us from drawing any layer that's outside its min/maxzoom limits (or has its visibility toggled to 'none'). Now that we're doing explicit time-based fade animations, it should be possible for us to animate these transitions -- we just need to (1) make sure the min/maxzoom calculation is fed into collision detection, and (2) update the drawing code to keep drawing any layers in the middle of fading (assuming this is a significant savings over just drawing the layer with nothing in it).

I noticed this while zooming in on a city label: at z14 in streets v10, place-city-label-lg will disappear abruptly. It doesn't look that bad, but it'd still be a nice improvement to fade it.

/cc @ansis @nickidlugash @jfirebaugh

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with StyleLayer.isHidden() and trace how min/maxzoom limits reach collision detection and the drawing code. Check the city-label case described for place-city-label-lg at z14; done means layers crossing zoom limits fade smoothly while visibility changes still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.