Merge pull request #152 from Pax1601/151-spawn-menu-not-working-in-firefox

PointerEvent changed to MouseEvent.
This commit is contained in:
Pax1601 2023-03-27 09:19:50 +02:00 committed by GitHub
commit efae7c23ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -141,13 +141,16 @@ function checkSessionHash(newSessionHash: string) {
function setupEvents() {
/* Generic clicks */
document.addEventListener("click", (ev) => {
if (ev instanceof PointerEvent && ev.target instanceof HTMLElement) {
if (ev instanceof MouseEvent && ev.target instanceof HTMLElement) {
const target = ev.target;
if (target.classList.contains("olympus-dialog-close")) {
target.closest("div.olympus-dialog")?.classList.add("hide");
}
const triggerElement = target.closest("[data-on-click]");
if (triggerElement instanceof HTMLElement) {
const eventName: string = triggerElement.dataset.onClick || "";
let params = JSON.parse(triggerElement.dataset.onClickParams || "{}");