16 lines
408 B
JavaScript
16 lines
408 B
JavaScript
/**
|
|
* @param {Event} event
|
|
* @return {void}
|
|
*/
|
|
function handleDialogClick(event) {
|
|
const dialog = event.currentTarget;
|
|
const rect = dialog.getBoundingClientRect();
|
|
const clickedInDialog =
|
|
rect.top <= event.clientY &&
|
|
event.clientY <= rect.top + rect.height &&
|
|
rect.left <= event.clientX &&
|
|
event.clientX <= rect.left + rect.width;
|
|
if (!clickedInDialog) {
|
|
dialog.close();
|
|
}
|
|
}
|