[英]Leaflet geojson layer feature group mouse pointer
By default when you hover over a feature group in leaflet the mouse pointer will change to a 'pointer'.默认情况下,当您将鼠标悬停在传单中的要素组上时,鼠标指针将变为“指针”。 I was wondering if there was an easy way to override this default behavior.
我想知道是否有一种简单的方法可以覆盖此默认行为。 I would like to not change the mouse pointer as in our use case, the feature group is not 'clickable'
在我们的用例中,我不想更改鼠标指针,功能组不可“点击”
看起来,当您创建图层时,您可以传入 'clickable:false' 作为禁用可点击类型样式的选项。
The clickable:false
answer does not work. clickable:false
答案不起作用。 Instead, set the path options style of the GeoJSON while creating it.相反,在创建 GeoJSON 时设置它的路径选项样式。 The property to set is
interactive:false
, like so:要设置的属性是
interactive:false
,如下所示:
let yourGeoJSONLayer = L.geoJSON(yourGeoJSON, {style:{interactive:false}});
yourGeoJSONLayer.addTo(map);
L.geoJSON
takes a GeoJSON options object, of which the style value is a Path options object. L.geoJSON
接受一个GeoJSON 选项对象,其中的样式值是一个Path 选项对象。 This inherits options from InteractiveLayer
, which has a default setting of interactive
to true
.这继承了
InteractiveLayer
选项,其默认设置为interactive
为true
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.