mapbox / mapbox/mapbox-gl-js

Add a `background-type` paint property

Open
#11,489 3 comments 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

## Motivation

We've heard accounts of it being confusing that a checkered background was shown in Studio when choosing a projection other than `mercator`:

![background](https://user-images.githubusercontent.com/61150/153070617-488bbeeb-0472-419b-8c72-22cf7b2691f9.gif)

We create that checkered background in Studio **but more broadly**: It's slightly weird (exacerbated by `globe`) that a `background` layer wraps around a projection itself and isn't strictly the background styling of the canvas.

## Proposal

An enum that let's us change the behavior of background to render in governance to its projection or the viewport.

```json
"background-type": {
"type": "enum",
"default": "map",
"values": {
"map": {
"doc": "Renders the background layer to the projected map"
},
"viewport": {
"doc": "Renders the background layer to the canvas"
}
}
}
```

Doing something would also allow us to apply a `background-pattern` (i.e creating a starry space backdrop).

---

**Mapbox GL JS version:** `2.7.0-alpha.1`

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

The issue names Studio, the background layer, projections, and Mapbox GL JS 2.7.0-alpha.1, but no source files or tests. Start by locating the background paint-property definition and the rendering paths for projected maps and the canvas; done means supporting the map and viewport enum values while preserving the current default behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.