aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rect.coffee
diff options
context:
space:
mode:
authormrmr19932017-07-04 12:50:30 +0100
committermrmr19932017-11-01 07:48:39 +0000
commit60ca3238e5e5d35f3ed6acbbadd370f432b746ef (patch)
treefbef3a3857578be9503f65ba28242c85abce1081 /lib/rect.coffee
parente424bb942b58e5cee3506e42b6f3aa9008eb7b17 (diff)
downloadvimium-60ca3238e5e5d35f3ed6acbbadd370f432b746ef.tar.bz2
Rename Rect.rectOverlaps to Rect.intersectsStrict, clarify the comment
Diffstat (limited to 'lib/rect.coffee')
-rw-r--r--lib/rect.coffee10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/rect.coffee b/lib/rect.coffee
index 703c640c..0e9c3417 100644
--- a/lib/rect.coffee
+++ b/lib/rect.coffee
@@ -74,6 +74,11 @@ Rect =
rect1.bottom > rect2.top and
rect1.top < rect2.bottom
+ # Determine whether two rects overlap, including 0-width intersections at borders.
+ intersectsStrict: (rect1, rect2) ->
+ rect1.right >= rect2.left and rect1.left <= rect2.right and
+ rect1.bottom >= rect2.top and rect1.top <= rect2.bottom
+
equals: (rect1, rect2) ->
for property in ["top", "bottom", "left", "right", "width", "height"]
return false if rect1[property] != rect2[property]
@@ -83,11 +88,6 @@ Rect =
@create (Math.max rect1.left, rect2.left), (Math.max rect1.top, rect2.top),
(Math.min rect1.right, rect2.right), (Math.min rect1.bottom, rect2.bottom)
- # Determine whether two rects overlap.
- 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
extend window, root unless exports?