new round of fixing eslint findings
This commit is contained in:
parent
c6f88e8d85
commit
7299157521
|
@ -31,6 +31,8 @@
|
||||||
"function-paren-newline": ["warn", "consistent"],
|
"function-paren-newline": ["warn", "consistent"],
|
||||||
"no-magic-numbers": ["error", {"ignore": [0,1,2,100]}],
|
"no-magic-numbers": ["error", {"ignore": [0,1,2,100]}],
|
||||||
"quote-props": ["warn", "as-needed"],
|
"quote-props": ["warn", "as-needed"],
|
||||||
"no-unused-vars": ["error", {"argsIgnorePattern": "^_"}]
|
"no-unused-vars": ["error", {"argsIgnorePattern": "^_"}],
|
||||||
|
"max-len" : ["warn", {"code": 88}],
|
||||||
|
"capitalized-comments": "off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
30
melpomene.js
30
melpomene.js
|
@ -327,10 +327,10 @@ function moveReaderDisplayToArea(pageNumber, oWidth, oHeight, oPosx, oPosy)
|
||||||
|
|
||||||
|
|
||||||
// Align the top-left corner of the frame with the page
|
// Align the top-left corner of the frame with the page
|
||||||
READER_PAGES.style.transform = "translate(-" + previousPagesWidth(pageNumber) + "px, -" + pageVerticalOffset(pageNumber) + "px )";
|
READER_PAGES.style.transform = `translate(-${previousPagesWidth(pageNumber)}px, -${pageVerticalOffset(pageNumber)}px)`;
|
||||||
|
|
||||||
// Then move so the top-left point of the zoom match the frame top-left
|
// Then move so the top-left point of the zoom match the frame top-left
|
||||||
READER_PAGES.style.transform = "translate(" + (- posx) + "px, " + (-posy) + "px )" + READER_PAGES.style.transform;
|
READER_PAGES.style.transform = `translate(${-posx}px, ${-posy}px) ${READER_PAGES.style.transform}`;
|
||||||
|
|
||||||
// Then, scale so the zoom would fit the frame, and center the zoom
|
// Then, scale so the zoom would fit the frame, and center the zoom
|
||||||
if (width === 0)
|
if (width === 0)
|
||||||
|
@ -350,12 +350,12 @@ function moveReaderDisplayToArea(pageNumber, oWidth, oHeight, oPosx, oPosy)
|
||||||
// Frame wider than zoom => scale so heights are the same, offset on x
|
// Frame wider than zoom => scale so heights are the same, offset on x
|
||||||
const zoomToFrameScaleFactor = READER_CONTENT_FRAME.clientHeight / height;
|
const zoomToFrameScaleFactor = READER_CONTENT_FRAME.clientHeight / height;
|
||||||
|
|
||||||
READER_PAGES.style.transform = "scale(" + zoomToFrameScaleFactor + ")" + READER_PAGES.style.transform;
|
READER_PAGES.style.transform = `scale(${zoomToFrameScaleFactor}) ${READER_PAGES.style.transform}`;
|
||||||
|
|
||||||
const scaledWidth = width * zoomToFrameScaleFactor;
|
const scaledWidth = width * zoomToFrameScaleFactor;
|
||||||
const offset = (READER_CONTENT_FRAME.clientWidth - scaledWidth) / 2;
|
const offset = (READER_CONTENT_FRAME.clientWidth - scaledWidth) / 2;
|
||||||
|
|
||||||
READER_PAGES.style.transform = "translateX(" + offset + "px)" + READER_PAGES.style.transform;
|
READER_PAGES.style.transform = `translateX(${offset}px) ${READER_PAGES.style.transform}`;
|
||||||
|
|
||||||
updateFocusByWidth(scaledWidth);
|
updateFocusByWidth(scaledWidth);
|
||||||
}
|
}
|
||||||
|
@ -365,12 +365,12 @@ function moveReaderDisplayToArea(pageNumber, oWidth, oHeight, oPosx, oPosy)
|
||||||
// Frame narower than zoom => scale so left/right match, offset on y
|
// Frame narower than zoom => scale so left/right match, offset on y
|
||||||
const zoomToFrameScaleFactor = READER_CONTENT_FRAME.clientWidth / width;
|
const zoomToFrameScaleFactor = READER_CONTENT_FRAME.clientWidth / width;
|
||||||
|
|
||||||
READER_PAGES.style.transform = "scale(" + zoomToFrameScaleFactor + ")" + READER_PAGES.style.transform;
|
READER_PAGES.style.transform = `scale(${zoomToFrameScaleFactor}) ${READER_PAGES.style.transform}`;
|
||||||
|
|
||||||
const scaledHeight = height * zoomToFrameScaleFactor;
|
const scaledHeight = height * zoomToFrameScaleFactor;
|
||||||
const offset = (READER_CONTENT_FRAME.clientHeight - scaledHeight) / 2;
|
const offset = (READER_CONTENT_FRAME.clientHeight - scaledHeight) / 2;
|
||||||
|
|
||||||
READER_PAGES.style.transform = "translateY(" + offset + "px)" + READER_PAGES.style.transform;
|
READER_PAGES.style.transform = `translateY(${offset}px) ${READER_PAGES.style.transform}"`;
|
||||||
|
|
||||||
updateFocusByHeight(scaledHeight);
|
updateFocusByHeight(scaledHeight);
|
||||||
}
|
}
|
||||||
|
@ -402,28 +402,28 @@ function moveReaderDisplayToZoom(index)
|
||||||
|
|
||||||
function updateFocusByWidth(width)
|
function updateFocusByWidth(width)
|
||||||
{
|
{
|
||||||
FOCUS_OVERLAY_WIDTH.style.width = (width / READER_CONTENT_FRAME.clientWidth * 100) + "%";
|
FOCUS_OVERLAY_WIDTH.style.width = `${width / READER_CONTENT_FRAME.clientWidth * 100}%`;
|
||||||
FOCUS_OVERLAY_HEIGHT.style.height = "100%";
|
FOCUS_OVERLAY_HEIGHT.style.height = "100%";
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFocusByHeight(height)
|
function updateFocusByHeight(height)
|
||||||
{
|
{
|
||||||
FOCUS_OVERLAY_WIDTH.style.width = "100%";
|
FOCUS_OVERLAY_WIDTH.style.width = "100%";
|
||||||
FOCUS_OVERLAY_HEIGHT.style.height = (height / READER_CONTENT_FRAME.clientHeight * 100) + "%";
|
FOCUS_OVERLAY_HEIGHT.style.height = `${height / READER_CONTENT_FRAME.clientHeight * 100}%`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleViewMode()
|
function toggleViewMode()
|
||||||
{
|
{
|
||||||
if (IS_PAGE_MODE)
|
if (IS_PAGE_MODE)
|
||||||
{
|
{
|
||||||
if (CURRENT_ZOOM !== null)
|
if (CURRENT_ZOOM === null)
|
||||||
{
|
{
|
||||||
moveReaderDisplayToZoom(CURRENT_ZOOM);
|
moveReaderDisplayToZoom(getFirstZoomOfPage(CURRENT_PAGE));
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
moveReaderDisplayToZoom(getFirstZoomOfPage(CURRENT_PAGE));
|
moveReaderDisplayToZoom(CURRENT_ZOOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
IS_PAGE_MODE = false;
|
IS_PAGE_MODE = false;
|
||||||
|
@ -453,8 +453,11 @@ function moveReader(toNext)
|
||||||
moveReaderDisplayToPage(CURRENT_PAGE - 1);
|
moveReaderDisplayToPage(CURRENT_PAGE - 1);
|
||||||
CURRENT_ZOOM = null;
|
CURRENT_ZOOM = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateProgressBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Zoom mode
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (toNext && CURRENT_ZOOM < PAGES_ZOOMS.length - 1)
|
if (toNext && CURRENT_ZOOM < PAGES_ZOOMS.length - 1)
|
||||||
|
@ -466,10 +469,10 @@ function moveReader(toNext)
|
||||||
{
|
{
|
||||||
moveReaderDisplayToZoom(CURRENT_ZOOM - 1);
|
moveReaderDisplayToZoom(CURRENT_ZOOM - 1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
updateProgressBar();
|
updateProgressBar();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// =============
|
// =============
|
||||||
|
@ -542,14 +545,11 @@ function handleMouseWhell(event)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MOUSEWHELL_WAIT = true;
|
MOUSEWHELL_WAIT = true;
|
||||||
setTimeout(
|
setTimeout(
|
||||||
() => { MOUSEWHELL_WAIT = false; },
|
() => { MOUSEWHELL_WAIT = false; },
|
||||||
MOUSEWHELL_MIN_DELAY
|
MOUSEWHELL_MIN_DELAY
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
if (event.deltaY > 0)
|
if (event.deltaY > 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue