keep pages centred in fitWidth mode.

This commit is contained in:
Bala Clark 2013-11-26 21:39:33 +01:00
parent a730b56faf
commit 628dadf370

View file

@ -543,15 +543,19 @@ var ComicBook = (function ($) {
canvas.width = (canvas_width < windowWidth()) ? windowWidth() : canvas_width;
canvas.height = (canvas_height < window.innerHeight) ? window.innerHeight : canvas_height;
// work out a horizontal position that will keep the pages always centred
if (canvas_width < windowWidth() && options.zoomMode === 'manual') {
offsetW = (windowWidth() - page_width) / 2;
if (options.displayMode === 'double') { offsetW = offsetW - page_width / 2; }
}
// always keep pages centered
if (options.zoomMode === 'manual' || options.zoomMode === 'fitWindow') {
// work out a vertical position that will keep the pages always centred
if (canvas_height < window.innerHeight && options.zoomMode === 'manual') {
offsetH = (window.innerHeight - page_height) / 2;
// work out a horizontal position
if (canvas_width < windowWidth()) {
offsetW = (windowWidth() - page_width) / 2;
if (options.displayMode === 'double') { offsetW = offsetW - page_width / 2; }
}
// work out a vertical position
if (canvas_height < window.innerHeight) {
offsetH = (window.innerHeight - page_height) / 2;
}
}
// in manga double page mode reverse the page(s)