mapbox / mapbox/leaflet-image

L_PREFER_CANVAS and fillColor hatch

Open
#79 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
380
Forks
140
PR merge metrics
No merged PRs in 30d

Description

I have a leaflet map that is using the canvas setting (L_PREFER_CANVAS=true) so as to not use SVGs to be compatible with leaflet-image but this is causing a problem. In my geoJson, I'm setting the style to use a fillColor of url(#diagonalHatch). When the canvas setting is false (i.e. using SVGs), it displays correctly with the diagonal lines. However, when the setting is true, I end up with a blank area covering that section of the map. Examples below.
Is there a way to draw the hash marks across that area using leaflet and canvas to work with leaflet-image? Or is there another alternative to get something similar?

Examples.
Original: original
Using leaflet-image: leaflet-image

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

No repository files, tests, or entry points are named. Start by reproducing the issue with L_PREFER_CANVAS=true and a GeoJSON fillColor of url(#diagonalHatch); done means the affected area no longer renders blank and has a documented canvas-compatible equivalent or clear limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.