( subject: LayoutRect, container: LayoutRect, tolerance: number, )
| 73 | } |
| 74 | |
| 75 | export function computeOverflow( |
| 76 | subject: LayoutRect, |
| 77 | container: LayoutRect, |
| 78 | tolerance: number, |
| 79 | ): LayoutOverflow | null { |
| 80 | const overflow: LayoutOverflow = {}; |
| 81 | |
| 82 | if (subject.left < container.left - tolerance) { |
| 83 | overflow.left = roundPx(container.left - subject.left); |
| 84 | } |
| 85 | if (subject.right > container.right + tolerance) { |
| 86 | overflow.right = roundPx(subject.right - container.right); |
| 87 | } |
| 88 | if (subject.top < container.top - tolerance) { |
| 89 | overflow.top = roundPx(container.top - subject.top); |
| 90 | } |
| 91 | if (subject.bottom > container.bottom + tolerance) { |
| 92 | overflow.bottom = roundPx(subject.bottom - container.bottom); |
| 93 | } |
| 94 | |
| 95 | return Object.keys(overflow).length > 0 ? overflow : null; |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * Whether a computed `overflow*` value clips its box. Mirrors the rule the |
no test coverage detected