aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.ts
diff options
context:
space:
mode:
authorLionel Han <47760119+IGoByJoe@users.noreply.github.com>2021-01-17 11:48:16 -0800
committerLionel Han <47760119+IGoByJoe@users.noreply.github.com>2021-01-17 11:48:16 -0800
commitfd4a1c602396362e9f0a1effa87fc751614e541b (patch)
tree400d22b39d3e8281f34b8834cf4c73ddc1a9551e /src/Utils.ts
parent692e619d8775e273c32e7bde804718b3e691088b (diff)
parentf4f4cb6b3a639c3e1c0d291f1d290e80097cfa06 (diff)
changes
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,