Boris D. Teoharov Boris D. Teoharov - 1 month ago 27
Javascript Question

Google maps api-3: Change polygon's default cursor

I can change the map's draggableCursor for example but I even if I change it polygon's cursor is still pointer since the map is behind polygons. I would like to set the polygon's cursor to 'move' so as to be clear that polygon is draggable.

What is the proper way to change polygon's cursor? Is there a property or method to do it? (Ive read Google's documentation but I didnt find anything)

I have reason to use Polygon over Polyline so Polyline is not an option.


Actually it seems to be possible. Here is the idea.

.moving * {cursor: move !important;} 


google.maps.event.addListener(myPolygon, 'mousemove',
    function(e) {
        if (!isNaN(e.edge) || !isNaN(e.vertex))
            mapCanvas.className = '';
            mapCanvas.className = 'moving';        

google.maps.event.addListener(myPolygon, 'mouseout',
    function() {
        mapCanvas.className = '';