Skip to content

fix: consider strokeWidth when calculating polyline visibility#2184

Merged
JaffaKetchup merged 6 commits into
fleaflet:masterfrom
braindamagedman:fix/thick-polyline-visibility
Apr 13, 2026
Merged

fix: consider strokeWidth when calculating polyline visibility#2184
JaffaKetchup merged 6 commits into
fleaflet:masterfrom
braindamagedman:fix/thick-polyline-visibility

Conversation

@braindamagedman

@braindamagedman braindamagedman commented Feb 23, 2026

Copy link
Copy Markdown
Contributor

For thick polylines, setting cullingMargin: null is not always sufficient: if all polyline points are outside the viewport, the polyline is not rendered. This can be undesirable in many cases.

ezgif-27183e0c0d11c842-ezgif com-loop-count

@JaffaKetchup

Copy link
Copy Markdown
Member

Thanks for submitting this! We'll try to take a look at it as soon as we can :)

@braindamagedman

Copy link
Copy Markdown
Contributor Author

I fixed the formatting, but I’m not sure how to deal with the scoring issues.

@JaffaKetchup JaffaKetchup requested a review from a team February 28, 2026 15:33
@JaffaKetchup JaffaKetchup changed the title Calculate polyline visibility based on strokeWidth feat: calculate polyline visibility based on strokeWidth Feb 28, 2026
@JaffaKetchup JaffaKetchup changed the title feat: calculate polyline visibility based on strokeWidth fix: calculate polyline visibility based on strokeWidth Mar 14, 2026
@JaffaKetchup JaffaKetchup changed the title fix: calculate polyline visibility based on strokeWidth fix: consider strokeWidth when calculating polyline visibility Mar 14, 2026

@JaffaKetchup JaffaKetchup left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! Although would be good to get another @fleaflet/maintainers' review.

This does result in an additional call to metersToScreenPixels (which involves projections) for each polyline+world when it may have been culled before, but if this gives the correct result, it's necessary so its fine.

(Just a note to readers, this doesn't fix the case where polylines disappear to early when the stroke width is 'large' and cullingMargin isn't null and hasn't been increased to account for this.)

@JaffaKetchup JaffaKetchup merged commit b35130f into fleaflet:master Apr 13, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants