gpt4 book ai didi

google-maps - 谷歌地图 - GeoJSON.js - 替换光标

转载 作者:行者123 更新时间:2023-12-02 03:37:57 25 4
gpt4 key购买 nike

我有一张 Google map 。我正在使用 GeoJSON.js当用户鼠标悬停在一个区域上时显示多边形的库。然而,这会将光标从十字准线切换到手指指针。如何继续使用十字准线光标?

我在 mapOptions 中定义了十字光标:

draggableCursor: 'crosshair' 

我是否需要将多边形的可点击属性设置为 false 为 a comment to this question implies ?如果是这样,我如何使用 GeoJSON.js 执行此操作?

JusticeMap.org -- Website that I'm working on and having the issue

最佳答案

经过一些尝试,我发现唯一的方法是从多边形中删除可点击选项。为此,找到 showFeature 函数并将此代码添加到末尾:

function modifyPolygon(polygon){
//TODO check if the parameter is really a polygon. maybe you can check an apposite flag to
//choose between different polygons
polygon.setOptions({clickable: false});
}

//Shows a feature - main function
function showFeature(geojson, clear, style){
[...]
modifyPolygon(currentFeature_or_Features);
}

因为您已经设置了 draggableCursor: 'crosshair' 光标也会在多边形上保持十字准线。我使用在 GitHub 上找到的代码对此进行了测试(使用 index.htm 和 GeoJSON.js)并且有效。

关于google-maps - 谷歌地图 - GeoJSON.js - 替换光标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22080806/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com