aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-12-16 21:39:47 -0500
committerbobzel <zzzman@gmail.com>2020-12-16 21:39:47 -0500
commit0fbfb06c499d2ee52b086427cbf1c5431fadfad9 (patch)
tree0630334a1ebce2bada102c37a8936772cd68b6df /src/Utils.ts
parentf5527e423c3eaa104bec4904f6c778cf1f58a496 (diff)
simplified DocumentView a bit more. cleaned up other code.
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..852a00406 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -592,6 +592,14 @@ export function lightOrDark(color: any) {
}
}
+export function isTarget(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,