A fork of https://github.com/ueokande/vim-vixen
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
823 B
40 lines
823 B
const SCROLL_DELTA = 48; |
|
|
|
const scrollLines = (page, count) => { |
|
let x = page.scrollX; |
|
let y = page.scrollY + SCROLL_DELTA * count; |
|
page.scrollTo(x, y); |
|
}; |
|
|
|
const scrollPages = (page, count) => { |
|
let height = page.innerHeight; |
|
let x = page.scrollX; |
|
let y = page.scrollY + height * count; |
|
page.scrollTo(x, y); |
|
}; |
|
|
|
const scrollTop = (page) => { |
|
let x = page.scrollX; |
|
let y = 0; |
|
page.scrollTo(x, y); |
|
}; |
|
|
|
const scrollBottom = (page) => { |
|
let x = page.scrollX; |
|
let y = page.scrollMaxY; |
|
page.scrollTo(x, y); |
|
}; |
|
|
|
const scrollLeft = (page) => { |
|
let x = 0; |
|
let y = page.scrollY; |
|
page.scrollTo(x, y); |
|
}; |
|
|
|
const scrollRight = (page) => { |
|
let x = page.scrollMaxX; |
|
let y = page.scrollY; |
|
page.scrollTo(x, y); |
|
}; |
|
|
|
export { scrollLines, scrollPages, scrollTop, scrollBottom, scrollLeft, scrollRight }
|
|
|