Can I change Cursor on hover of point?
In Scatterplot layer, can I change cursor to pointer on hover of plotted points? ex. https://news.google.com/covid19/map
let isHovering = false;
Deck({
...
onHover: ({object}) => (isHovering = Boolean(object)),
getCursor: ({isDragging}) => (isDragging ? 'grabbing' : (isHovering ? 'pointer' : 'grab'))
})
Thanks @Pessimistress .
Hey,
How does this work with DeckGL instead?
isHovering is passed to getCursor as of v8.4.
Version 8.8.15 here. Is it possible that ScatterplotLayer doesn't implement getCursor? I needed to read 'isHovering' to change the cursor, but it seems to me that nothing changes if using it. i.e.:
getCursor: (cursor: any) => {
console.log(cursor);
return 'crosshair';
}
doesn't log anything, nor changes cursor to 'crosshair'.
EDIT: (I corrected my self also here Sorry, I just realized that I can use:
onHover: (info: any) => {console.log(info)}
inside the new Deck declaration and then check for info.layer.id to be or not the one I need. then I can change any variable on my needs..
I think this is not clear on the documentation.
I got here because the cursor wasn't changing, but I'm using the GoogleMapsOverlay and realized I needed to change the google map cursor instead, so this worked just fine:
getCursor: ({ isHovering, isDragging }) => {
if (isHovering) {
map.setOptions({ draggableCursor: "pointer" });
} else {
map.setOptions({ draggableCursor: "" });
}
return "grab";
},