Double click on leaflet, how to prevent zoom?

I can see that we have a Double click event:
image

But it seems, it only zooms in.

Is there other way to achieve something like this?

With js is like:

function onMapDoubleClick(e) {
var latLng = e.latlng;
marker.setLatLng(latLng);
}

map.on('dblclick', onMapDoubleClick);
map.doubleClickZoom.disable();

Thanks!

Now you see why the script is so large! Sorry @franse couldn't resist...

:joy:

hahah I know this will probably end on something like:

disablezoom="true"
1 Like

I believe it is:

zoomControl: false

Man I read so much on Stack about Leaflet over the past few weeks if it were a book I think I could quote chapter, paragraph, and line number!

:smiley:

I think those are for the buttons
Actually get hidden on zoom-control="false"
image

But still not working.

I guess some custom js doesn't hurt anyone :slight_smile:

Yeah me too and now is here, hope everybody can find this really useful, it's a great feature

1 Like

We've not added this option to the component and the UI and it's on by default, but we can add it in the next update.
If you think there are more useful options that can be added to the UI, please let us know so we can add them.

3 Likes

You can test the following update: dmxLeafletMaps.zip (11.0 KB)

To the component add double-click-zoom="false" to disable the double click zoom handler.

Thanks @patrick will test it later.
The dynamic events are working? Tried on click = set lang long but doesn't seem to trigger, barely tested, but will check it again :thinking:

I had an test with the following mapclick event to add a marker which works fine

dmx-on:mapclick="mymap.addMarker({id: 'marker', tooltip: 'test', popup: 'Hello World', latitude: $event.latitude, longitude: $event.longitude})"

Thanks @patrick this works perfect.

But I can't set the marker to where the mouse is, like the video I posted above.
What I need is: marker.setLatLng(latLng);
But it seems there's no dynamic actions on the marker, all of them are only from the leaflet component.

Well you have to double click on the action on click on the + sign to add it first :slight_smile:

Sorry @George but, what I mean is about the marker, not the map, there's no action to place the marker to another position.

But maybe I can use dynamic lat/lng from the marker itself, instead on trying to move it, as there's no option.

Fixed in Wappler 6.6.2

This topic was automatically closed after 8 hours. New replies are no longer allowed.