Non-rendered, "optional" text labels preventing icons being drawn.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
mapbox-gl-js version: 1.0.0
browser: Firefox
Steps to Trigger Behavior
So I have these layers defined like this:
map.U.addCircle('sites-circles', 'sites', {
circleColor: 'black'
});
map.U.addSymbol('sites-pins', 'sites', {
iconImage: 'marker',
iconSize: 0.5,
iconOffset:[0,-30],
textField: '{Name}',
textOffset:[0,1],
textOptional: true,
textSize: 14,
textColor: 'hsl(331, 50%, 50%)',
textOpacity: { stops: [[12.5, 0], [13, 1]] }
});
What's really strange is a couple of those circles that don't have pins drawn (eg at the very top right and very bottom right).
If I change textField to '', more pins are drawn:
This seems really strange to me. For starters, the text labels are supposedly "optional", so why are they blocking the icons from being drawn? Also, at this zoom level, they aren't even being drawn (my understanding was that opacity: 0 was understood specially by mapbox-gl to mean, to not render at all).
Is there a better way to say "don't draw labels below this zoom level"?
Link to Demonstration
http://emscycletours.site44.com/gkn-bug/
Expected Behavior
The situation in the first screenshot should look like the second screenshot.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the linked demonstration in Firefox with the shown addSymbol configuration, then compare textOptional: true against textField: '' across the reported zoom levels. Investigate symbol placement and the textOpacity stops to determine why labels that are not rendered still block icons. Done means the first screenshot matches the expected icon placement or the behavior is clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- computer-graphics, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100