Fix image overlay not closing when clicking outside on Qt6.6 (#2861)

* Add type to createEventDispatcher

* Fix image overlay not closing when clicking outside on Qt6.6

Use Event.composedPath() instead of obsolete Event.path
https://chromestatus.com/feature/5726124632965120
This commit is contained in:
Hikaru Y 2023-12-04 13:57:03 +09:00 committed by GitHub
parent 843c0417b0
commit 820b833a43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -46,7 +46,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
/** This may be passed in for more fine-grained control */
export let show = true;
const dispatch = createEventDispatcher();
type CloseEventMap = {
close: Pick<EventPredicateResult, "reason"> & Partial<EventPredicateResult>;
};
const dispatch = createEventDispatcher<CloseEventMap>();
let arrow: HTMLElement;

View file

@ -255,7 +255,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
if (reason === "outsideClick") {
// If the click is still in the overlay, we do not want
// to reset the handle either
if (!originalEvent.path.includes(imageOverlay)) {
if (!originalEvent?.composedPath().includes(imageOverlay)) {
await resetHandle();
}
} else {