ArcGIS JavaScript API 3.9 - mouse-drag events don´t work in Internet Explorer 11

喜你入骨 提交于 2019-12-05 18:21:47

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 :)

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!