[Bug] Draw Polygon calls onClick for Map when drawing

Open
#2,331 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
react, typescript
Domain
frontend

Research direction

Start with examples/draw-polygon and compare the DrawControl behavior when it is placed inside Map with and without the Map onClick prop. Use the linked CodeSandbox to reproduce the conflict; done means polygon drawing still works while Map click handling remains available when the drawing tool is not selected.

Written by the indexing model from the issue text.

Description

bug
Description

When following this example and putting the DrawControl inside the Map, I cannot get the polygon to be drawn on the screen if the Map has an onClick prop. That will take priority of drawing on the screen. If I remove onClick, the polygon can be drawn.

Expected Behavior

To be able to have an onClick as well as a be able to draw a polygon. If the polygon drawing tool is selected, onClick should be ignore. How else can you respond to a maps click and have polygon draw functionality? They seem that they should be able to live in unison?

Steps to Reproduce

https://codesandbox.io/p/sandbox/laughing-mclaren-tc66sp

Environment
  • Framework version: 7.1.0
  • Map library: Any
  • Browser: Chrome
  • OS: Mac
Logs

No response

Dominant language
TypeScript
Stars
8.5k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Getting set up

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.

More from visgl/react-map-gl

All issues in visgl/react-map-gl

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.