Pass through mouse clicks while dialog overlay is dismissing.

This commit is contained in:
flash 2024-04-21 19:49:03 +00:00
parent 185a745f26
commit 20fc663bcb

View file

@ -6,6 +6,9 @@ const MamiMessageBoxContainer = function() {
const container = <div class="msgbox-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 = <form class="msgbox-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 = <form class="msgbox-dialog"/>;
const body = <div class="msgbox-dialog-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,