mapbox / mapbox/mapbox-gl-js

Eliminate `text-size`/`icon-size` evaluation special cases

Open
#5,683 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

As noted in https://github.com/mapbox/mapbox-gl-native/issues/10462#issuecomment-344449031, the symbol layout process currently evaluates `text-size` at up to five zoom levels and `icon-size` at up to three:

1. `text-size` at the zoom level of the bucket. Used to calculate a per-feature size for source `text-size` expressions (1a), and to calculate the box dimensions for icon-text-fit (1b).
2. `icon-size` at the zoom level of the bucket. Used to calculate a per-feature size for source `icon-size` expressions.
3. `text-size` and `icon-size` at the zoom level of the bucket, plus one. Used to calculate collision boxes.
4. `text-size` at zoom level 18. Used for something line-symbol-placement-related, possibly to reduce label movement by placing line labels in the same spot at different zoom levels. (Institutional knowledge is hazy.)
5. For composite `*-size` expressions: two zoom levels of curve stops that "cover" the zoom level of the bucket. These go into a vertex buffer and are used by the shader to interpolate the size at render time.

(1a), (2), and (5) are the non-special cases -- all data-driven properties require them. https://github.com/mapbox/mapbox-gl-js/issues/5656 tracks fixing or eliminating (1b).

This issue focuses on (3) and (4). From conversations with @ChrisLoer and @ansis, the introduction of viewport placement likely allows us to eliminate them. We should do that.

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 by reading the symbol layout process and the viewport placement work referenced in the issue, then review mapbox-gl-js issue 5656 for related scope. Trace the zoom-level evaluations for collision boxes and line-symbol placement; done means those special cases are eliminated while the remaining data-driven and shader interpolation evaluations continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
computer-graphics, frontend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.