« get me outta code hell

allow matching children of clickThrough: false els - tui-lib - Pure Node.js library for making visual command-line programs (ala vim, ncdu)
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2021-12-14 08:24:30 -0400
committer(quasar) nebula <qznebula@protonmail.com>2021-12-14 08:24:30 -0400
commit691dee525adec2bbdb0bb247b6561bc2b5b23bf2 (patch)
treec574b0a330fa2c6de077b8e246a990a56191e57b
parent085bab481b1ee8470f04cb6541ee01981e19f2c6 (diff)
allow matching children of clickThrough: false els
This caused clicks not to match the context menu in mtui, where the
container layer (a full-screen element) is marked clickThrough: false
(but the menu and its elements are not). Basically this meant clicking
menus has been broken for however long this code has been here.
-rw-r--r--ui/DisplayElement.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/ui/DisplayElement.js b/ui/DisplayElement.js
index a7a371a..32a62b8 100644
--- a/ui/DisplayElement.js
+++ b/ui/DisplayElement.js
@@ -233,7 +233,7 @@ module.exports = class DisplayElement extends Element {
     children.reverse()
 
     for (const el of children) {
-      if (!el.visible || el.clickThrough) {
+      if (!el.visible) {
         continue
       }
 
@@ -242,6 +242,10 @@ module.exports = class DisplayElement extends Element {
         return el2
       }
 
+      if (el.clickThrough) {
+        continue
+      }
+
       const { absX, absY, w, h } = el
       if (absX <= x && absX + w > x) {
         if (absY <= y && absY + h > y) {