scroll lines action

This commit is contained in:
Shin'ya Ueoka 2017-08-27 10:12:12 +09:00
parent 6213f55e22
commit 02c0cfd97d
4 changed files with 8 additions and 19 deletions

View file

@ -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]);

View file

@ -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 }