From b89180bdbf8c1fb532a96a2fa235e7bfe45fb46b Mon Sep 17 00:00:00 2001 From: 0neGal Date: Wed, 19 Jun 2024 23:49:24 +0200 Subject: auto deselect selection if its no longer visible --- src/app/js/navigate.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/app/js') diff --git a/src/app/js/navigate.js b/src/app/js/navigate.js index 465a7ec..b54bbfd 100644 --- a/src/app/js/navigate.js +++ b/src/app/js/navigate.js @@ -842,4 +842,23 @@ events.on("popup-changed", (e) => { }, 300) }) +// automatically deselect a selection if its no longer visible +setInterval(() => { + // get the active selection + let active_el = document.querySelector(".active-selection"); + + if (! active_el) {return} + + let visible = active_el.checkVisibility({ + checkOpacity: true, + visibilityProperty: true, + checkVisibilityCSS: true, + contentVisibilityAuto: true + }) + + if (! visible) { + navigate.default_selection(); + } +}, 500) + module.exports = navigate; -- cgit v1.2.3