[Bug]PolygonLayer.getFillColor not invoked if data is an arbitrary "object that implements the iterable protocol"
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 14.6k
- Forks
- 2.3k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 42
Description
Description
if PolygonLayer.data is an arbitrary "object that implements the iterable protocol", getFillColor is not necessarily invoked.
Flavors
- Script tag
- React
- Python/Jupyter notebook
- MapboxOverlay
- GoogleMapsOverlay
- CARTO
- ArcGIS
Expected Behavior
if PolygonLayer.data is an arbitrary object that implements the iterable protocol, getFillColor is invoked for all objects returned by the iterator.
Steps to Reproduce
Given:
function createLayer(name: string, iterableObject: Iterable<[number, number][]>): Layer {
return new PolygonLayer<[number, number][]>({
id: name,
data: iterableObject,
getPolygon: region => region,
lineWidthMinPixels: 1,
getFillColor: [0, 206, 209, 160],
})
}
const rectangle: [number, number][] = [[-122.4, 37.7], [-122.4, 37.8], [-122.5, 37.8], [-122.5, 37.7], [-122.4, 37.7]]
const MY_REGIONS = new Map<string, [number, number][]>([['Rectangle', rectangle]])
For a layer created like this
createLayer('ok', Array.from(MY_REGIONS.values()))
getFillColor is invoked:
But not for a layer created like this:
createLayer('error', MY_REGIONS.values())
Environment
- Framework version: deck.gl@9.1.3
- Browser: Microsoft Edge Version 133.0.3065.82, Firefox 135.0.1, Opera 117.0.5408.39
- OS: Microsoft Windows [Version 10.0.19045.5371]
Logs
Empty
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the PolygonLayer data-iteration entry point and reproduce the difference between Array.from(MY_REGIONS.values()) and MY_REGIONS.values() using the provided example. The fix is complete when getFillColor is invoked for every polygon yielded by an arbitrary iterable, with regression coverage for both data forms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100