aboutsummaryrefslogtreecommitdiff
path: root/src/app/js/navigate.js
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2024-06-19 23:49:24 +0200
committer0neGal <mail@0negal.com>2024-06-19 23:49:24 +0200
commitb89180bdbf8c1fb532a96a2fa235e7bfe45fb46b (patch)
treec7cc9fbedaf966c3ca0d4345c60f8ef1cf89f580 /src/app/js/navigate.js
parentc9adaaf47d18946b93b32bed8237d87d0e02f405 (diff)
downloadViper-b89180bdbf8c1fb532a96a2fa235e7bfe45fb46b.tar.gz
Viper-b89180bdbf8c1fb532a96a2fa235e7bfe45fb46b.zip
auto deselect selection if its no longer visible
Diffstat (limited to 'src/app/js/navigate.js')
-rw-r--r--src/app/js/navigate.js19
1 files changed, 19 insertions, 0 deletions
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;