[Bug] Picking for custom layers should be optional and shouldn't log warnings
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 you create a custom layer (inheriting from Layer) but do not include the 'picking' module you get a warning: "hook.js:608 luma.gl: Module picking not found". This is caused by picking logic in the base Layer class, specifically the call in _postUpdate function to: setShaderModuleProps({picking}).
Ideally no warning should be raised for custom layers that don't require interactivity/picking. One workaround is to override the setShaderModuleProps function in your custom layer to intercept/swallow this call, however, it seems like there should be a way to disable picking altogether that would avoid all of picking related logic/methods/etc.. Perhaps moving the picking logic to a higher-level PickableLayer class instead of including it in the base Layer class might be another way to approach this?
Flavors
- Script tag
- React
- Python/Jupyter notebook
- MapboxOverlay
- GoogleMapsOverlay
- CartoLayer
- ArcGIS
Expected Behavior
Ideally no warnings would be logged when creating a custom layer that doesn't require picking. Superfluous warnings make it easy for other important warnings to be overlooked.
Steps to Reproduce
Create a custom layer, but do not include the picking module.
Environment
- Framework version: 9.0.36
- Browser: any
- OS: any
Logs
No response
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 in the base Layer class at _postUpdate and inspect the setShaderModuleProps({picking}) call and related picking logic. Reproduce a custom layer without the picking module, then trace how the warning is emitted and determine a focused way to disable or avoid picking for that layer. Done means such layers produce no picking-module warning while pickable layers retain their behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100