diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-08-27 10:12:12 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-08-27 10:12:12 +0900 |
commit | 02c0cfd97d44c8568dee6f0d11d2e45732309c67 (patch) | |
tree | 3ac86ccfaabaa86acd23a0f46821c6511223db0a /src/content | |
parent | 6213f55e22f79eb8b7572a619e0fc68047c0631e (diff) |
scroll lines action
Diffstat (limited to 'src/content')
-rw-r--r-- | src/content/index.js | 7 | ||||
-rw-r--r-- | src/content/scrolls.js | 10 |
2 files changed, 4 insertions, 13 deletions
diff --git a/src/content/index.js b/src/content/index.js index 2bbe39c..b233e27 100644 --- a/src/content/index.js +++ b/src/content/index.js @@ -42,11 +42,8 @@ const invokeEvent = (action) => { createFooterLine('open '); } break; - case actions.SCROLL_UP: - scrolls.scrollUp(window, action[1] || 1); - break; - case actions.SCROLL_DOWN: - scrolls.scrollDown(window, action[1] || 1); + case actions.SCROLL_LINES: + scrolls.scrollLines(window, action[1]); break; case actions.SCROLL_TOP: scrolls.scrollTop(window, action[1]); diff --git a/src/content/scrolls.js b/src/content/scrolls.js index 2a233c2..ef112a4 100644 --- a/src/content/scrolls.js +++ b/src/content/scrolls.js @@ -1,12 +1,6 @@ const SCROLL_DELTA = 48; -const scrollUp = (page, count) => { - let x = page.scrollX; - let y = page.scrollY - SCROLL_DELTA * count; - page.scrollTo(x, y); -}; - -const scrollDown = (page, count) => { +const scrollLines = (page, count) => { let x = page.scrollX; let y = page.scrollY + SCROLL_DELTA * count; page.scrollTo(x, y); @@ -24,4 +18,4 @@ const scrollBottom = (page) => { page.scrollTo(x, y); }; -export { scrollUp, scrollDown, scrollTop, scrollBottom } +export { scrollLines, scrollTop, scrollBottom } |