mapbox / mapbox/mapbox-gl-js

line-trim-offset without lineMetrics available makes line disappear

Open
#12,081 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

`line-trim-offset` works only if lineMetrics is set for geojson sources. When it isn't set, the line disappears completely. It shouldn't disappear and a warning should be logged.

**mapbox-gl-js version**: v2.9.1

**browser**: all

### Steps to Trigger Behavior

1. open debug/debug.html
2. map.setPaintProperty('route', 'line-trim-offset', [0, 0.5])

### Link to Demonstration

http://localhost:9966/debug/debug.html#12.5/38.88894/-77.01842

### Expected Behavior

The route line is still rendered without clipping. A warning is logged once explaining that `lineMetrics` needs to be set for the property to work correctly.

### Actual Behavior

Line disappears.

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 debug/debug.html and reproduce the issue using map.setPaintProperty('route', 'line-trim-offset', [0, 0.5]) on a GeoJSON source without lineMetrics. Trace the line-trim-offset handling and verify that the line remains visible while a warning is logged once explaining that lineMetrics is required for correct behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.