MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / modalDialogCloseOnBackdropClick

Function modalDialogCloseOnBackdropClick

ui/media/js/utils.js:1142–1157  ·  view source on GitHub ↗
(dialog)

Source from the content-addressed store, hash-verified

1140}
1141
1142function modalDialogCloseOnBackdropClick(dialog) {
1143 dialog.addEventListener('mousedown', function (event) {
1144 // Firefox creates an event with clientX|Y = 0|0 when choosing an <option>.
1145 // Test whether the element interacted with is a child of the dialog, but not the
1146 // dialog itself (the backdrop would be a part of the dialog)
1147 if (dialog.contains(event.target) && dialog != event.target) {
1148 return
1149 }
1150 var rect = dialog.getBoundingClientRect()
1151 var isInDialog = (rect.top <= event.clientY && event.clientY <= rect.top + rect.height
1152 && rect.left <= event.clientX && event.clientX <= rect.left + rect.width)
1153 if (!isInDialog) {
1154 dialog.close()
1155 }
1156 })
1157}
1158
1159function makeDialogDraggable(element) {
1160 element.querySelector(".dialog-header").addEventListener('mousedown', (function () {

Callers 3

main.jsFile · 0.85
image-modifiers.jsFile · 0.85

Calls 1

addEventListenerMethod · 0.45

Tested by

no test coverage detected