Google Maps API-3:更改多边形的默认光标 [英] Google maps api-3: Change polygon's default cursor
问题描述
例如,我可以更改地图的draggableCursor,但是即使我更改了它,我也仍然可以将多边形的光标作为指针,因为地图位于多边形之后.我想将多边形的光标设置为移动",以使多边形可以拖动.
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屋!