Leaflet / Leaflet/Leaflet.VectorGrid
The "click" event cannot be generated on layers with point geometry.
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 676
- Forks
- 202
- PR merge metrics
- No merged PRs in 30d
Description
Hi everyone. I'm trying to capture the "click" event of an L.VectorGrid.Protobuf instance as follows:
layer.on("click", handler);
The event works for layers with "Polygon" and "LineString" geometry; however, for "Point" geometry layers, the following error appears in the console:
Uncaught TypeError: Cannot read properties of undefined (reading 'lat')
at Object.project (leaflet.js?v=49550133:1117:95)
at Object.latLngToPoint (leaflet.js?v=49550133:1019:48)
at NewClass.project (leaflet.js?v=49550133:2646:35)
at NewClass.latLngToLayerPoint (leaflet.js?v=49550133:2665:37)
at NewClass.latLngToContainerPoint (leaflet.js?v=49550133:2715:55)
at NewClass._fireDOMEvent (leaflet.js?v=49550133:2954:51)
at NewClass._handleDOMEvent (leaflet.js?v=49550133:2923:16)
at HTMLDivElement.handler (leaflet.js?v=49550133:1733:21)
My map's initialization has no parameters other than zoom and center. The layer has the interactive parameter set to true.
Contributor guide
No contributing guide indexed for this repository
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 with the L.VectorGrid.Protobuf entry point and its layer.on("click", handler) event path, then reproduce the failure using a point-geometry layer with interactive enabled. Trace how the Leaflet DOM event handler obtains the event location; done means point clicks fire without the undefined lat error. No repository file or test is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100