diff options
| author | Joanne <zehan_ding@brown.edu> | 2025-06-24 10:15:04 -0400 |
|---|---|---|
| committer | Joanne <zehan_ding@brown.edu> | 2025-06-24 10:15:04 -0400 |
| commit | ad1f2ffb01fef49449c2dd5875659e1c904558fd (patch) | |
| tree | 3c586cc104b18b9bc183ebf875c970292aae06ca /src/Utils.ts | |
| parent | 17ec2a19b2d2dc5ba3f99c43d86c27946de2ac71 (diff) | |
| parent | 1396850b90ed2dcca3776057ec4a7f2fc7ff297a (diff) | |
Merge branch 'master' of https://github.com/brown-dash/Dash-Web into joanne-tutorialagent
Diffstat (limited to 'src/Utils.ts')
| -rw-r--r-- | src/Utils.ts | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Utils.ts b/src/Utils.ts index 724725c23..e96b8e231 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -202,6 +202,9 @@ export function aggregateBounds(boundsList: { x: number; y: number; width?: numb export function intersectRect(r1: { left: number; top: number; width: number; height: number }, r2: { left: number; top: number; width: number; height: number }) { return !(r2.left > r1.left + r1.width || r2.left + r2.width < r1.left || r2.top > r1.top + r1.height || r2.top + r2.height < r1.top); } +export function rectContains(r1: { left: number; top: number; width: number; height: number }, r2: { left: number; top: number; width: number; height: number }) { + if (r1.left < r2.left && r1.left + r1.width > r2.left + r2.width && r1.top < r2.top && r1.top + r1.height > r2.top + r2.height) return true; +} export function stringHash(s?: string) { return !s ? undefined : Math.abs(s.split('').reduce((a, b) => (n => n & n)((a << 5) - a + b.charCodeAt(0)), 0)); |
