Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with react-map-gl #396

Open
Teyae opened this issue Jul 6, 2023 · 2 comments
Open

issue with react-map-gl #396

Teyae opened this issue Jul 6, 2023 · 2 comments
Labels
❓ question Further information is requested

Comments

@Teyae
Copy link

Teyae commented Jul 6, 2023

Threebox version: 2.2.7

Question

When I use threebox-plugin with react-map-gl , I can't select object, it seem like mouse click event is prevented, does anyone encounter the same problem?

@Teyae Teyae added the ❓ question Further information is requested label Jul 6, 2023
@Clamb94
Copy link

Clamb94 commented Dec 15, 2023

Hi,
yes, I just encountered the same problem and can't tell why.
As soon as I initialize a new threebox(...), I can't click my markes on the map anymore.

Were you able to solve it?
I tried debugging a bit and see threebox fires e.preventDefault(); incorrectly at a onClick function, but that's not the case

@Clamb94
Copy link

Clamb94 commented Dec 15, 2023

Looks like I found a solution. Just add a high css z-index to the react-map-gl object you want to click on.
Like this:

        <Marker
          key={`marker-1}`}
          longitude={8.5}
          latitude={50.032642}
          anchor="bottom"
          style={{ zIndex: 1000 }} // <- Add this
          onClick={(e) => {
            console.log('Clicked on event'); // Click works!
            e.originalEvent.stopPropagation();
          }}
        >
          {...}
        </Marker>

So far I haven't found any issues with this solution. Threebox still detects clicks on objects etc. just fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓ question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants