more corrections

This commit is contained in:
caribaud 2023-06-11 09:51:47 +02:00 committed by Christian Aribaud
parent b3fddef4e0
commit 21e17a294e
2 changed files with 28 additions and 17 deletions

View File

@ -34,6 +34,7 @@
"no-unused-vars": ["error", {"argsIgnorePattern": "^_"}], "no-unused-vars": ["error", {"argsIgnorePattern": "^_"}],
"max-len" : ["warn", {"code": 88}], "max-len" : ["warn", {"code": 88}],
"capitalized-comments": "off", "capitalized-comments": "off",
"operator-linebreak": ["warn", "before"] "operator-linebreak": ["warn", "before"],
"max-lines": "off"
} }
} }

View File

@ -39,26 +39,36 @@ const PROGRESS_BAR = document.getElementById("melpomene-progress-bar");
const PROGRESS_BAR_PAGES = document.getElementById("melpomene-progress-sections"); const PROGRESS_BAR_PAGES = document.getElementById("melpomene-progress-sections");
const VERSION_DISPLAY = document.getElementById("melpomene-version"); const VERSION_DISPLAY = document.getElementById("melpomene-version");
// ====================
// INDEX CONSTANTS
// ====================
const ZOOM_PAGE_INDEX = 0;
const ZOOM_WIDTH_INDEX = 1;
const ZOOM_HEIGHT_INDEX = 2;
const ZOOM_X_INDEX = 3;
const ZOOM_Y_INDEX = 4;
// =========================== // ===========================
// STATES GLOBAL VARIABLES // STATES GLOBAL VARIABLES
// =========================== // ===========================
var PAGES_ZOOMS; let PAGES_ZOOMS;
// The variable ZOOMS can either be defined by another JS file or contructed at init // The variable ZOOMS can either be defined by another JS file or contructed at init
if (typeof PAGES_ZOOMS === "undefined") if (typeof PAGES_ZOOMS === "undefined")
{ {
PAGES_ZOOMS = null; PAGES_ZOOMS = null;
} }
var CURRENT_ZOOM = 0; let CURRENT_ZOOM = 0;
var CURRENT_PAGE = 1; let CURRENT_PAGE = 1;
var CURRENT_WIDTH = 0; let CURRENT_WIDTH = 0;
var CURRENT_HEIGHT = 0; let CURRENT_HEIGHT = 0;
var CURRENT_X = 0; let CURRENT_X = 0;
var CURRENT_Y = 0; let CURRENT_Y = 0;
var IS_PAGE_MODE = false; let IS_PAGE_MODE = false;
var MOUSEWHELL_WAIT = false; let MOUSEWHELL_WAIT = false;
// ============= // =============
// UTILITIES // UTILITIES
@ -360,17 +370,17 @@ function moveReaderDisplayToPage(pageNumber)
moveReaderDisplayToArea(pageNumber, 0, 0, 0, 0); moveReaderDisplayToArea(pageNumber, 0, 0, 0, 0);
} }
function moveReaderDisplayToZoom(index) function moveReaderDisplayToZoom(zoomIdx)
{ {
moveReaderDisplayToArea( moveReaderDisplayToArea(
PAGES_ZOOMS[index][0], PAGES_ZOOMS[zoomIdx][ZOOM_PAGE_INDEX],
PAGES_ZOOMS[index][1], PAGES_ZOOMS[zoomIdx][ZOOM_WIDTH_INDEX],
PAGES_ZOOMS[index][2], PAGES_ZOOMS[zoomIdx][ZOOM_HEIGHT_INDEX],
PAGES_ZOOMS[index][3], PAGES_ZOOMS[zoomIdx][ZOOM_X_INDEX],
PAGES_ZOOMS[index][4] PAGES_ZOOMS[zoomIdx][ZOOM_Y_INDEX]
); );
CURRENT_ZOOM = index; CURRENT_ZOOM = zoomIdx;
} }
function toggleViewMode() function toggleViewMode()