summaryrefslogtreecommitdiff
path: root/apps/web/src/utils/browser.ts
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2026-03-25 16:47:22 +0100
committerMaze Winther <mazewinther@gmail.com>2026-03-29 15:48:22 +0200
commit8db3bead13441a5882d8689dfc6a9f09c82375d9 (patch)
treee9d0cafa93904ffcbec3188c37961bcc16c6422d /apps/web/src/utils/browser.ts
parent39ea298a9ccba3104c549c0ca079c231981811f5 (diff)
downloadopencut-8db3bead13441a5882d8689dfc6a9f09c82375d9.tar.gz
feat: masks, properties refactor, shaders, storage migrations, and more
Diffstat (limited to 'apps/web/src/utils/browser.ts')
-rw-r--r--apps/web/src/utils/browser.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/web/src/utils/browser.ts b/apps/web/src/utils/browser.ts
index cfd3b31b..bfe69b11 100644
--- a/apps/web/src/utils/browser.ts
+++ b/apps/web/src/utils/browser.ts
@@ -15,6 +15,20 @@ export function downloadBlob({
URL.revokeObjectURL(url);
}
+export function findScrollParent({
+ element,
+}: {
+ element: HTMLElement;
+}): HTMLElement | null {
+ let parent = element.parentElement;
+ while (parent) {
+ const { overflow, overflowX } = window.getComputedStyle(parent);
+ if (/auto|scroll/.test(overflow + overflowX)) return parent;
+ parent = parent.parentElement;
+ }
+ return null;
+}
+
export function isTypableDOMElement({
element,
}: {