aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.ts
diff options
context:
space:
mode:
authorusodhi <61431818+usodhi@users.noreply.github.com>2020-12-17 16:22:06 +0530
committerusodhi <61431818+usodhi@users.noreply.github.com>2020-12-17 16:22:06 +0530
commit48fd017c46b930ae94e341ae73bfc35006008b44 (patch)
tree488aae6f3864622548c01433867309cc0bd03a24 /src/Utils.ts
parent563d86f03f63f60ec47aef23d2022c660ee18697 (diff)
parentf4f4cb6b3a639c3e1c0d291f1d290e80097cfa06 (diff)
merged
Diffstat (limited to 'src/Utils.ts')
-rw-r--r--src/Utils.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Utils.ts b/src/Utils.ts
index 1a00c0bfb..f160df6f7 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -592,6 +592,14 @@ export function lightOrDark(color: any) {
}
}
+export function hasDescendantTarget(x: number, y: number, target: HTMLDivElement | null) {
+ let entered = false;
+ for (let child = document.elementFromPoint(x, y); !entered && child; child = child.parentElement) {
+ entered = entered || child === target;
+ }
+ return entered;
+}
+
export function setupMoveUpEvents(
target: object,
e: React.PointerEvent,