mapbox / mapbox/mapbox-gl-js

Respect text-offset in line-placed symbol collision handling

Open
#4,798 4 comments 2 reactions 1 assignee View on GitHub

@ChrisLoer is already working on this.

Since May 5, 2018.

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

Description

We currently do not respect the value of `text-offset` when determining whether two symbol instances collide.

Example -- in this style:

```js
{
"version": 8,
"metadata": {
"test": {
"height": 64,
"collisionDebug": true
}
},
"center": [ 0, 0 ],
"zoom": 0,
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [
[-20, -20],
[20, -20],
[20, 20],
[-20, 20]
]
}
}
}
},
"glyphs": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf",
"layers": [
{
"id": "guid",
"type": "line",
"source": "geojson"
},
{
"id": "text",
"type": "symbol",
"source": "geojson",
"layout": {
"symbol-placement": "line",
"symbol-spacing": 115,
"text-size": 10,
"text-allow-overlap": false,
"text-ignore-placement": false,
"text-field": "A",
"text-font": [
"Open Sans Semibold",
"Arial Unicode MS Bold"
],
"text-keep-upright": false,
"text-offset": [0, -3]
}
}
]
}
```

We'd expect only one of the 'A' instances to be rendered, but both are:

screen shot 2017-06-07 at 8 28 18 am

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.