From 20fc663bcb9ac8fcd60f4854c998fac78487ac74 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sun, 21 Apr 2024 19:49:03 +0000 Subject: [PATCH] Pass through mouse clicks while dialog overlay is dismissing. --- src/mami.js/controls/msgbox.jsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mami.js/controls/msgbox.jsx b/src/mami.js/controls/msgbox.jsx index 2192323..0c32f4a 100644 --- a/src/mami.js/controls/msgbox.jsx +++ b/src/mami.js/controls/msgbox.jsx @@ -6,6 +6,9 @@ const MamiMessageBoxContainer = function() { const container =
; return { + set pointerEvents(value) { + container.style.pointerEvents = value ? null : 'none'; + }, getElement: () => container, show: async dialog => { if(typeof dialog !== 'object' || dialog === null) @@ -37,6 +40,7 @@ const MamiMessageBoxDialog = function(info) { { name: 'cancel', text: 'Cancel', reject: true }, ]; + const dialog =
; let showResolve, showReject; const doResolve = (...args) => { @@ -44,6 +48,7 @@ const MamiMessageBoxDialog = function(info) { return; showReject = undefined; + dialog.style.pointerEvents = 'none'; showResolve(...args); }; const doReject = (...args) => { @@ -51,11 +56,10 @@ const MamiMessageBoxDialog = function(info) { return; showResolve = undefined; + dialog.style.pointerEvents = 'none'; showReject(...args); }; - const dialog = ; - const body =
; dialog.appendChild(body); @@ -177,6 +181,8 @@ const MamiMessageBoxDialog = function(info) { }); }, dismiss: async () => { + dialog.style.pointerEvents = 'none'; + await MamiAnimate({ async: true, duration: 600, @@ -231,6 +237,8 @@ const MamiMessageBoxControl = function(options) { }; const raise = async () => { + container.pointerEvents = true; + if(!views.isCurrent(container)) views.raise(container, ctx => MamiAnimate({ async: true,