Google maps api-3:更改多边形的默认光标 [英] Google maps api-3: Change polygon's default cursor

查看:108
本文介绍了Google maps api-3:更改多边形的默认光标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我可以更改地图的draggableCursor,但即使更改多边形的光标仍然是指针,因为地图位于多边形后面。我想将多边形的光标设置为'move',以清楚地表明多边形是可拖动的。

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.

更改多边形光标的正确方法是什么?是否有财产或方法来做到这一点? (我已阅读Google的文档,但没有发现任何内容)

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)

ps。
我有理由在Polyline上使用Polygon,所以Polyline不是一个选项。

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

推荐答案

实际上它似乎是可能的。
这是主意。

css:

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

.moving,
.moving * {cursor: move !important;} 





js:

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

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

干杯!

这篇关于Google maps api-3:更改多边形的默认光标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆