Documentation

Disable Zoom and Pan

Leaflet SDK provides abilities to disable map zoom and pan events. For example, you can disable panning of the map with following line of code.

map.dragging.disable();

To disable map zoom on different mouse/touch actions, you can use any of the following functions or all together.

map.touchZoom.disable();
map.doubleClickZoom.disable();
map.scrollWheelZoom.disable();

This will disable the zoom on scroll, double click or touch, but to reset zoom on map control buttons you need to add following lines of code.

var zoom;
community.on("indoorCommunityLoadComplete", function(e) {
      // initial zoom
      zoom = map.getZoom();
});
                
// reset zoom when clicked on zoom control
map.on("zoomend", function(e) {
      if(zoom && map.getZoom() != zoom) {
          map.setZoom(zoom);
      }
});

Here, we are storing initial map zoom into a variable and on every zoom change, we are resetting it to default.