diff options
| author | mrmr1993 | 2017-07-04 12:40:25 +0100 |
|---|---|---|
| committer | mrmr1993 | 2017-11-01 07:46:22 +0000 |
| commit | 8cd39d357b129e40b1e3a8fc99910bf4c76747c0 (patch) | |
| tree | f074672a5888c1924fb84560979a5fccc4957418 | |
| parent | fb081c8963196926cd8c5ab6d16b3d5928f8198f (diff) | |
| download | vimium-8cd39d357b129e40b1e3a8fc99910bf4c76747c0.tar.bz2 | |
Refine definition of Rects.rectsOverlap
| -rw-r--r-- | lib/rect.coffee | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/rect.coffee b/lib/rect.coffee index 59764d18..fdeace25 100644 --- a/lib/rect.coffee +++ b/lib/rect.coffee @@ -83,13 +83,9 @@ Rect = (Math.min rect1.right, rect2.right), (Math.min rect1.bottom, rect2.bottom) # Determine whether two rects overlap. - rectsOverlap: do -> - halfOverlapChecker = (rect1, rect2) -> - (rect1.left <= rect2.left <= rect1.right or rect1.left <= rect2.right <= rect1.right) and - (rect1.top <= rect2.top <= rect1.bottom or rect1.top <= rect2.bottom <= rect1.bottom) - - (rect1, rect2) -> - halfOverlapChecker(rect1, rect2) or halfOverlapChecker rect2, rect1 + rectsOverlap: (rect1, rect2) -> + rect1.right >= rect2.left and rect1.left <= rect2.right and + rect1.bottom >= rect2.top and rect1.top <= rect2.bottom root = exports ? (window.root ?= {}) root.Rect = Rect |
