Moving constants to own section
This commit is contained in:
parent
ebf21375ef
commit
64dbb0a1e7
|
@ -1,29 +1,42 @@
|
|||
//============
|
||||
// CONTROLS
|
||||
//============
|
||||
|
||||
MOVE_NEXT = "ArrowRight"
|
||||
MOVE_BACK = "ArrowLeft"
|
||||
TOGGLE_FULLSCREEN = "F"
|
||||
|
||||
|
||||
//========================
|
||||
// NAVIGATION CONSTANTS
|
||||
//========================
|
||||
|
||||
PAGE_TRANSITION_SPEED = "1.5s"
|
||||
MOUSEWHELL_MIN_DELAY = 50
|
||||
|
||||
|
||||
//====================
|
||||
// STATES CONSTANTS
|
||||
//====================
|
||||
|
||||
READER_FRAME = document.getElementById("reader-frame")
|
||||
|
||||
READER_PAGES = document.getElementById("reader-pages")
|
||||
|
||||
FOCUS_OVERLAY = document.getElementById("focus-overlay")
|
||||
|
||||
CURRENT_ZOOM = 0
|
||||
|
||||
CURRENT_PAGE = 1
|
||||
|
||||
CURRENT_WIDTH = 0
|
||||
CURRENT_HEIGHT = 0
|
||||
CURRENT_X = 0
|
||||
CURRENT_Y = 0
|
||||
|
||||
IS_PAGE_MODE = false
|
||||
|
||||
MOUSEWHELL_MIN_DELAY = 50
|
||||
MOUSEWHELL_WAIT = false
|
||||
|
||||
// ===========
|
||||
|
||||
// =============
|
||||
// UTILITIES
|
||||
// ===========
|
||||
// =============
|
||||
|
||||
// Zooms utilites
|
||||
// --------------
|
||||
|
@ -260,17 +273,22 @@ function moveReader(to_next, move_page) {
|
|||
|
||||
}
|
||||
|
||||
|
||||
// =============
|
||||
// CALLBACKS
|
||||
// =============
|
||||
|
||||
function handleKeyPress(key, has_ctrl){
|
||||
|
||||
if (key == "ArrowRight") {
|
||||
if (key == MOVE_NEXT) {
|
||||
moveReader(true, has_ctrl)
|
||||
}
|
||||
|
||||
else if (key == "ArrowLeft") {
|
||||
else if (key == MOVE_BACK) {
|
||||
moveReader(false, has_ctrl)
|
||||
}
|
||||
|
||||
else if (key == "f"){
|
||||
else if (key.toUpperCase() == TOGGLE_FULLSCREEN){
|
||||
if (document.fullscreenElement == null){
|
||||
READER_FRAME.requestFullscreen();
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue