hotfix if you have ONLY ONE map at page.
- "ugly!!", but at least something:
<script>
var xlisteners = [];
//var gmapref = document.querySelector(".k-map") !! null
var f = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function (type, fn, capture) {
//this.f = f;
if (type == "wheel" && this.className.includes("k-map")) {
if (xlisteners.length > 0) { /*alert('skip...' + xlisteners.length);*/ return; }//DO NOTHING
this.f = f;
xlisteners.push(fn);//for later cleanup use...
this.f(type, fn, capture);
//alert('added...' + xlisteners.length);
}
else {
this.f = f;
this.f(type, fn, capture);
}
}
//jf you want it call from code like: await JS.InvokeVoidAsync("mcleanup", "abcdefg");
function mcleanup(mid) {
if (xlisteners.length > 1) {
var element = document.querySelector(".k-map");
for (let i = 1; i < xlisteners.length; i++) {
console.log(i, xlisteners[i]);
element.removeEventListener("wheel", xlisteners[i], { passive: true });
}
//xlisteners.forEach((it) => { element.removeEventListener("wheel", it, { passive: true }); console.log(it); });
xlisteners.splice(1);
alert('removed...');
}
}
</script>
info for previous post:
- "hotfix" means, how to safely remove event listener "wheel", which is randomly multiplicating(maybe its caused by Map.Refresh() method? ). There should be only ONE listener.
Example of wrong 5 event listeners assigned to map and every of them do the scrool. So you get scrolled 5x per mouse wheel up/down:
if i delete it in browser object inspector, and leave only "one", everything is ok.
Some kind of "cleaner"(js call from code) will help, before full fix will be available.
Hi,
is there some temporary "external hotfix"?
- like: disabling mouse wheel zoom at JS level. Just mouse wheel, no others variants.
On every refresh, the zoom step of the mouse wheel increases. If the component is refreshed several times, the mouse wheel zooming and the +/- buttons from the keyboard become very confusing. They zoom in and out to the maximum/minimum zoom level. The MapControlsZoom component works properly.
If the map is used in application that intends to dynamically show different items on the map, the zooming quickly becomes a problem.