简体   繁体   中英

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. Instead, set the path options style of the GeoJSON while creating it. The property to set is interactive:false , like so:

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. This inherits options from InteractiveLayer , which has a default setting of interactive to true .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM