GoogleMapsOverlay does not support getCursor
Target Use case
I would like to be able to change the cursor when using deck.gl with Google Maps. It seems to always just inherit the cursor from the Google Map underneath.
Specifically, I was trying to change the cursor on hover of an icon within an IconLayer. If I weren't using Google Maps I could set the getCursor method on the Deck properties. However, the GoogleMapsOverlay documentation shows that this is not supported.
Proposed feature
Allow the getCursor property to be set on a GoogleMapsOverlay. Alternatively, support the getCursor property on a Layer (would probably easier to use).
To Do List
- [ ] Add label and assign to milestone
- [ ] Coding
- [ ] Doc update
- [ ] What’s new update
- [ ] Test
We do set the cursor style on the overlay but it doesn't seem to be effective. Does Google Maps API allow you specify your own cursor override? @donmccurdy
@Pessimistress Google Maps does allow changing the drag cursor via the draggableCursor property. The problem is that I want the default drag cursor except for when I'm hovering on an icon in an IconLayer. I was able to get around it by setting the Google Maps draggableCursor to "pointer" when the deck.gl onHover handler receives an object, and setting the cursor back to "grab" when the when the cursor leaves the icon. It's hacky and more low leveled state management than I'd like, but it works okay.
onHover: (info) => {
this.googleMap.setOptions({draggableCursor: info.object ? "pointer" : "grab"});
}
I'm not sure how it would work if there were native Google maps pins or interactable elements in the same area which would change the cursor and mean it wasn't using the draggable cursor.
Perhaps deck.gl could be modified to take control of the cursor in the same manner under the hood.
Does Google Maps API allow you specify your own cursor override?
Not elegantly, but the 'draggableCursor' property is one option. Another would be CSS or equivalent JS:
.gm-style:first-of-type > div:nth-child(1) {
cursor: default !important;
}
The downside of using draggableCursor is it assumes the user has not disabled dragging. The downside of the CSS is that it's obviously hacky... And I'm not confident either of these will automatically do the right thing if multiple non-deckgl overlays or markers are present.
Perhaps deck.gl could be modified to take control of the cursor in the same manner under the hood.
Unfortunately I doubt that's possible right now. There is a fairly strong assumption within Maps API that it manages mouse events itself.