1
0
Fork 0
firefox/browser/extensions/webcompat/injections/js/bug1911423-app.powerbi.com-emulate-mousewheel-events.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

38 lines
1.2 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* globals exportFunction */
/**
* Bug 1911423 - app.powerbi.com - zooming is broken on maps
*
* They listen for non-standard mousewheel events, rather than wheel,
* which breaks zooming. This emulates mousewheel events for them.
*/
console.info(
"Emulating mousewheel events for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1911423 for details."
);
(function () {
const { prototype } = window.wrappedJSObject.WheelEvent;
Object.defineProperty(prototype, "type", {
configurable: true,
get: exportFunction(() => "mousewheel", window),
set: exportFunction(() => {}, window),
});
})();
(function () {
const { prototype } = window.wrappedJSObject.EventTarget;
const { addEventListener } = prototype;
prototype.addEventListener = exportFunction(function (type, fn, c, d) {
if (type === "mousewheel") {
type = "wheel";
}
return addEventListener.call(this, type, fn, c, d);
}, window);
})();