diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-09 21:24:01 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-09 21:24:01 +0900 |
commit | b580ef8170a31f7cbef3103d1017f89a6f105319 (patch) | |
tree | aaba38ee6a4a7443a5b60b189444f4e02d4c248f /src/content/scrolls.js | |
parent | 447466808f484d4baa6b285f2dbcaf1920db5498 (diff) | |
parent | cf36bf192ccbc6ffd175e4dd397b4a9140b7f28b (diff) |
Merge pull request #28 from ueokande/horizonal-scroll
Horizonal scroll
Diffstat (limited to 'src/content/scrolls.js')
-rw-r--r-- | src/content/scrolls.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/content/scrolls.js b/src/content/scrolls.js index b1cea6f..86ea554 100644 --- a/src/content/scrolls.js +++ b/src/content/scrolls.js @@ -1,8 +1,15 @@ -const SCROLL_DELTA = 48; +const SCROLL_DELTA_X = 48; +const SCROLL_DELTA_Y = 48; -const scrollLines = (page, count) => { +const scrollVertically = (page, count) => { let x = page.scrollX; - let y = page.scrollY + SCROLL_DELTA * count; + let y = page.scrollY + SCROLL_DELTA_X * count; + page.scrollTo(x, y); +}; + +const scrollHorizonally = (page, count) => { + let x = page.scrollX + SCROLL_DELTA_Y * count; + let y = page.scrollY; page.scrollTo(x, y); }; @@ -25,18 +32,19 @@ const scrollBottom = (page) => { page.scrollTo(x, y); }; -const scrollLeft = (page) => { +const scrollHome = (page) => { let x = 0; let y = page.scrollY; page.scrollTo(x, y); }; -const scrollRight = (page) => { +const scrollEnd = (page) => { let x = page.scrollMaxX; let y = page.scrollY; page.scrollTo(x, y); }; export { - scrollLines, scrollPages, scrollTop, scrollBottom, scrollLeft, scrollRight + scrollVertically, scrollHorizonally, scrollPages, + scrollTop, scrollBottom, scrollHome, scrollEnd }; |