diff options
| author | mrmr1993 | 2015-04-28 00:12:55 +0100 | 
|---|---|---|
| committer | mrmr1993 | 2015-04-28 00:12:55 +0100 | 
| commit | 24ece1dc315e66a0e0bf24e27c4c89fa847ead08 (patch) | |
| tree | 8830408e57e06a749b9785ccf6ab1153fd3ffdb9 | |
| parent | 2de9bf879792b4be50efc09ee26d16008bb73ae7 (diff) | |
| download | vimium-24ece1dc315e66a0e0bf24e27c4c89fa847ead08.tar.bz2 | |
Fix bounds and amounts in scrollIntoView
| -rw-r--r-- | content_scripts/scroller.coffee | 16 | 
1 files changed, 8 insertions, 8 deletions
| diff --git a/content_scripts/scroller.coffee b/content_scripts/scroller.coffee index b7de5140..d1b7ec6c 100644 --- a/content_scripts/scroller.coffee +++ b/content_scripts/scroller.coffee @@ -256,22 +256,22 @@ Scroller =      rect = element. getClientRects()?[0]      if rect?        # Scroll y axis. -      if rect.top < 0 -        amount = rect.top - 10 +      if rect.bottom < 0 +        amount = rect.bottom - Math.min(rect.height, window.innerHeight)          element = findScrollableElement element, "y", amount, 1          CoreScroller.scroll element, "y", amount, false -      else if window.innerHeight < rect.bottom -        amount = rect.bottom - window.innerHeight + 10 +      else if window.innerHeight < rect.top +        amount = rect.top + Math.min(rect.height - window.innerHeight, 0)          element = findScrollableElement element, "y", amount, 1          CoreScroller.scroll element, "y", amount, false        # Scroll x axis. -      if rect.left < 0 -        amount = rect.left - 10 +      if rect.right < 0 +        amount = rect.right - Math.min(rect.width, window.innerWidth)          element = findScrollableElement element, "x", amount, 1          CoreScroller.scroll element, "x", amount, false -      else if window.innerWidth < rect.right -        amount = rect.right - window.innerWidth + 10 +      else if window.innerWidth < rect.left +        amount = rect.left + Math.min(rect.width - window.innerWidth, 0)          element = findScrollableElement element, "x", amount, 1          CoreScroller.scroll element, "x", amount, false | 
