0
votes

I am using ESRI map version 4.1 for generating map in my angular application and its working fine. What I want now is to disable zoom on double click on the map. I have done lot of googling and most of them suggestion stopPropagation() method, but the event itself is not having this function and its throwing error.

what I have tried is

view.on('double-click', function(event){
    event.stopPropagation()
});

It is giving me the error

event.stopPropagation is not a function

I am using ESRI javascript library version 4.1.

Anybody has any idea how can I stop zooming on double click?

2
codepen.io/mcantonbul/pen/YzKVRQJ It's working. Can u create example app? or I think you could try changing the name of the "event" variable. - Muhammet Can TONBUL
I am Using version 4.1. I have tried this link with 4.1 instead of 4.12, but its now zooming on double click:( - Sabith

2 Answers

1
votes

Esri 4.1 did not provide this feature in the library. You must either upgrade or intervene. In this way, you can intervene and control the "double-click" event with your own method.

https://codepen.io/mcantonbul/pen/YzKVRQJ

require(["esri/Map", "esri/views/MapView"], function(Map, MapView) {
  var map = new Map({
    basemap: "streets"
  });

  var view = new MapView({
    container: "viewDiv",
    map: map,
    zoom: 4,
    center: [15, 65] // longitude, latitude
  });
  var myCustomDoubleClick = function(event) {
    console.log(event);
  };
  view.gestureManager.handlers.last["double-click"] = myCustomDoubleClick;
});
0
votes

try something like ,

$( "#target" ).dblclick(function(event) {
 event.stopPropagation()
});