From 60ca3238e5e5d35f3ed6acbbadd370f432b746ef Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Tue, 4 Jul 2017 12:50:30 +0100 Subject: Rename Rect.rectOverlaps to Rect.intersectsStrict, clarify the comment --- lib/rect.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') 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? -- cgit v1.2.3