mapbox / mapbox/mapbox-gl-js

After setting the "line-cap" property to "round", adding the "line-dasharray" property to the line layer, and adjusting the "line-width" to a wider width, the line is not smooth and jagged at the cap

Open
#12,721 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

mapbox-gl-js version: v2.9.2
browser: Version 111.0.5563.147 (official version) (64-bit)

### Steps to Trigger Behavior
1. Add a line layer.
2. Set the "line-cap" property to "round", add the "line-dasharray" property to the line layer, adjust the "line-width" to be wider

### Link to Demonstration
https://codepen.io/SuperHuZhiPeng/pen/QWZzRXG

### Expected Behavior
The line-cap should be round and smooth, and should not have serrations.
### Actual Behavior
![lineCap1](https://github.com/mapbox/mapbox-gl-js/assets/96167408/95d4ed92-efd2-4485-b18f-9130c12801a0)
![lineCap2](https://github.com/mapbox/mapbox-gl-js/assets/96167408/65493de1-b884-4c2f-bd4a-26ee70b2c19b)

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

Reproduce the jagged round cap using the linked CodePen with mapbox-gl-js v2.9.2, a dashed line layer, and a wider line width. Then trace the line-layer rendering path responsible for dashed round caps and compare the rendered result with the expected smooth cap; done means the reproduction is smooth without serrations.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.