RodrigoHamuy / react-three-map

Use React and Three.js inside Mapbox and Maplibre
https://rodrigohamuy.github.io/react-three-map/
MIT License
208 stars 29 forks source link

Change cursor on hover - has no affect #129

Closed newguy123-creator closed 2 weeks ago

newguy123-creator commented 2 weeks ago

Problem description:

Usually I can easily add code to my model tag in my canvas to change the cursor to a pointer in a regular R3F app, however this doesnt seem to work in react-three-map. No matter what I do, the cursor stays the "grab" cursor.

Relevant code:

<Model
    position={[-3.855, 0, 180.526]}
    onClick={handleClick}
    onPointerEnter={() => {
        document.body.style.cursor = "pointer";
    }}
    onPointerLeave={() => {
        document.body.style.cursor = "default";
    }}
/>

Suggested solution:

RodrigoHamuy commented 2 weeks ago

That's because Maplibre and Mapbox also have a cursor style. You can aim at the canvas instead of the document body to have priority in the CSS hierarchy.

newguy123-creator commented 2 weeks ago

That's because Maplibre and Mapbox also have a cursor style. You can aim at the canvas instead of the document body to have priority in the CSS hierarchy.

Yes I gathered that. The question therefore is, how can I overrirde it and make my style important?