aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rect.coffee
diff options
context:
space:
mode:
authormrmr19932015-10-23 18:02:10 +0100
committermrmr19932015-10-23 18:02:10 +0100
commit6dd120cf67b75b35c2fced66644fa4eae4c86764 (patch)
treedc5c6f209a1855fe43f0b7940294d8b1951363b1 /lib/rect.coffee
parentad53ad0b0b9a75825caf796ff65e091deb784e84 (diff)
downloadvimium-6dd120cf67b75b35c2fced66644fa4eae4c86764.tar.bz2
Properly check whether the selection is visible in the current viewport
Diffstat (limited to 'lib/rect.coffee')
-rw-r--r--lib/rect.coffee4
1 files changed, 4 insertions, 0 deletions
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