2

I have created a map from geojson file of administrative boundaries (polygons layer).

Similar to this example. When the mouse is over the polygon feature, the cursor changes from hand to finger. In the finger mode, map does not zoom on double click.

In my case, at higher zoom, whole map is made of adjacent polygon features so the mouse is always in the finger mode. I need to be able to zoom in on double click.

  • One possible solution to this problem can be to use your mousewheel to zoom in & out instead click. – Farhat Abbas Jun 1 '14 at 11:18
4

Either what @poshan has written, or add this line to onEachFeature(feature, layer):

if( layer.options )
    layer.options.clickable = false;
| improve this answer | |
  • This is good one, is there a workaround to open popup on click. – neogeomat Jun 19 '14 at 4:59
  • Well, you can add a listener: layer.on('click', function() { layer.openPopup(); }); – Ilja Zverev Jun 19 '14 at 10:27
4

I think creating event on layers(polygon layers) will work.

layer_name.on('dblclick', function(e) {
a = map.getZoom();
map.setZoom(a + 1);})
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.