Pergunta

I am facing a problem with mouse-drag event form ArcGIS API for JavaScript 3.9 in Internet Explorer 11 The code is below:

map.on("mouse-drag", zobraudalost);
    
function zobraudalost() {
    alert("test");
}

The problem is that, this event doesn't fire at IE 11 (as well as mouse-drag-start, mouse-drag-end). But on the other browsers it works fine (IE9, Firefox, Chrome). The other problem is that other mouse events (click, mouse-move, etc) work fine on IE 11, so the problem is only with the mouse-drags.

Have ever you seen such problem? Do you know if there is some security settings in IE 11 which disable mouse drag events?

Foi útil?

Solução

Well, This issue was related to ArcGis JS API version.

I simply updated the API 3.9 to 3.16 and its started working in IE too.

Here is the running fiddler link to verify.

Fiddler : https://jsfiddle.net/vikash2402/j6h00uyt/1/

I verified in IE11, chrome and firefox.

var map;

require(["esri/map", "dojo/domReady!"], function(Map) {
    map = new Map("map", {
        basemap: "topo",
        center: [-122.45, 37.75], // longitude, latitude
        zoom: 13
    });
    
    map.on("mouse-drag", drag);
    
    function drag() {
        alert("mouse-drag");
    }
});
html, body, #map {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}
<link href="https://js.arcgis.com/3.16/esri/css/esri.css" rel="stylesheet"/>
<script src="https://js.arcgis.com/3.16/init.js"></script>


<body>
    <div id="map"></div>
</body>

Hoping this will help you :)

Outras dicas

I had similar problems attempting to catch mouseup in IE11. Here is the solution I found that worked:

Changed for the drag event you probably want.

if(window.PointerEvent) {
  elm.addEventListener("pointermove", foo);
} else if (window.MSPointerEvent) {
  elm.addEventListener("MSPointerMove", foo);
} else {
  elm.addEventListener("mousemove", foo);
}

Not your exact solution, but a combination of the above should do it.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top