From 6dd120cf67b75b35c2fced66644fa4eae4c86764 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Fri, 23 Oct 2015 18:02:10 +0100 Subject: Properly check whether the selection is visible in the current viewport --- lib/rect.coffee | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/rect.coffee b/lib/rect.coffee index adc1fc36..0c67d287 100644 --- a/lib/rect.coffee +++ b/lib/rect.coffee @@ -78,5 +78,9 @@ Rect = return false if rect1[property] != rect2[property] true + intersect: (rect1, rect2) -> + @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) + root = exports ? window root.Rect = Rect -- cgit v1.2.3