mirror of
https://github.com/ankitects/anki.git
synced 2025-11-11 07:07:13 -05:00
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:
parent
843c0417b0
commit
820b833a43
2 changed files with 6 additions and 2 deletions
|
|
@ -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 */
|
/** This may be passed in for more fine-grained control */
|
||||||
export let show = true;
|
export let show = true;
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
type CloseEventMap = {
|
||||||
|
close: Pick<EventPredicateResult, "reason"> & Partial<EventPredicateResult>;
|
||||||
|
};
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher<CloseEventMap>();
|
||||||
|
|
||||||
let arrow: HTMLElement;
|
let arrow: HTMLElement;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
if (reason === "outsideClick") {
|
if (reason === "outsideClick") {
|
||||||
// If the click is still in the overlay, we do not want
|
// If the click is still in the overlay, we do not want
|
||||||
// to reset the handle either
|
// to reset the handle either
|
||||||
if (!originalEvent.path.includes(imageOverlay)) {
|
if (!originalEvent?.composedPath().includes(imageOverlay)) {
|
||||||
await resetHandle();
|
await resetHandle();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue