diff options
| author | Stephen Blott | 2016-09-25 05:54:08 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2016-09-25 11:32:51 +0100 | 
| commit | 19e1178b16fd27882c7834d66ad6597847e6baff (patch) | |
| tree | 031f2fe139f921ecc432e3a8e3542e60c09afc9d /lib | |
| parent | 3df2dc7299051f96736b65ee8ed774e0d7fbb173 (diff) | |
| download | vimium-19e1178b16fd27882c7834d66ad6597847e6baff.tar.bz2 | |
Space rotates hints (to make hidden hints visible).
It is common for link-hint markers to be close togother, and
overlapping.
Here, `<Space>` rotates hint markers such that hidden markers become
visible.
For filtered hints we additionally require a modifier (because `<space>`
on its own is already a token separator).
The calculation of overlapping hints is quite expensive: O(n^2) in the
best case and O(n^3) in the worst cast.  The worst case is
extraordinarily unlikely to arise in practice.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/rect.coffee | 9 | 
1 files changed, 9 insertions, 0 deletions
| diff --git a/lib/rect.coffee b/lib/rect.coffee index 0c67d287..d4807cc2 100644 --- a/lib/rect.coffee +++ b/lib/rect.coffee @@ -82,5 +82,14 @@ 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: 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 +  root = exports ? window  root.Rect = Rect | 
