-
Notifications
You must be signed in to change notification settings - Fork 795
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(is-visible-on-screen): ignore elements hidden by overflow:hidden (#…
…3676) * fix(is-visible-on-screen): ignore elements hidden by overflow:hidden * finalize * suggestions * suggestions * revert files from prettier not in scope * move test
- Loading branch information
Showing
11 changed files
with
340 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { default as getOffset } from './get-offset'; | ||
export { default as hasVisualOverlap } from './has-visual-overlap'; | ||
export { default as rectsOverlap } from './rects-overlap'; | ||
export { default as splitRects } from './split-rects'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Determine if two rectangles touch. | ||
* @method rectsOverlap | ||
* @memberof axe.commons.math | ||
* @param {Rect} rect1 | ||
* @param {Rect} rect2 | ||
* @returns {Boolean} | ||
*/ | ||
export default function rectsOverlap(rect1, rect2) { | ||
// perform an AABB (axis-aligned bounding box) check. | ||
// account for differences in how browsers handle floating | ||
// point precision of bounding rects | ||
// @see https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection | ||
|
||
/* eslint-disable no-bitwise */ | ||
return ( | ||
(rect1.left | 0) < (rect2.right | 0) && | ||
(rect1.right | 0) > (rect2.left | 0) && | ||
(rect1.top | 0) < (rect2.bottom | 0) && | ||
(rect1.bottom | 0) > (rect2.top | 0) | ||
); | ||
/* eslint-enable no-bitwise */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.