Hi everyone,
I use geojson to draw polylines on the map and I have an 'onclick' event to change the color of the polyline.
The problem is that the hand cursor that is shown on hover for the the other geometries is not shown for polylines. That makes clicking on the polyline hard for the user (he has to try many times to click the polyline).
I wanted to ask if it is possible to have it at some future release of leaflet? and if not, why? and what other options do I have?
I include my javascript code segment bellow. Thank you all!
var geoJSON = L.geoJson({
"type": "Feature",
"properties": {
"id1": myarr[i][0],
"id2": myarr[i][1]
},
"geometry": {
"type": "LineString",
"coordinates": myarr[i][2]
}
}, {
style: {
weight: 2,
color: '#0033ff',
opacity: 1.0
},
onEachFeature: function (featureData, layer) {
layer.bindPopup("[ ID1, ID2 ] = [ " + featureData.properties.id1 + ", " + featureData.properties.id2 + " ]");
}
}).addTo(map);
geoJSON.on('click', function(e) {
e.target.eachLayer(function (layer) {
if (layer.options.weight == 2) {
e.target.setStyle({
weight: 5,
color: 'red',
opacity: 1.0
});
if (!
L.Browser.ie && !L.Browser.opera) {
e.target.bringToFront();
}
} else {
geoJSON.resetStyle(e.target);
}
});
});