[Feat] Add onTileLoading callback on TileLayers
Open
Nobody has claimed this yet.
feature
- Dominant language
- TypeScript
- Stars
- 14.6k
- Forks
- 2.3k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 42
Description
Target Use Case
Atm, any sort of TileLayer is missing a callback to know when tiles starts fetching. This could help devs implement a loading indicator that could be paired with onViewportLoad / onTileLoad.
I managed to implement it like this atm
return new CustomTileLayer({
...
onTilesLoading: () => setTilesLoading(mapId, layerId, true),
onViewportLoad: () => setTilesLoading(mapId, layerId, false)
});
interface CustomTileLayerProps {
onTilesLoading?: () => void;
}
class CustomTileLayer<DataT> extends TileLayer<DataT, CustomTileLayerProps> {
getTileData(tile: TileLoadProps) {
const {
props: { onTilesLoading }
} = this;
onTilesLoading?.();
return super.getTileData(tile) ;
}
}
Proposal
new TileLayer({
...
onTilesLoading: () => { /*show loading indicator here*/ },
onViewportLoad: () => { /*hide loading indicator here*/ }
});
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 TileLayer getTileData entry point shown in the issue and trace how tile fetching relates to onTileLoad and onViewportLoad. Add the proposed onTilesLoading callback to TileLayer's public API, then verify that it fires when tile fetching begins and can be used with the existing viewport-load callback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100