diff --git a/lib/ComicBook.js b/lib/ComicBook.js index d2e447d..f2e4961 100755 --- a/lib/ComicBook.js +++ b/lib/ComicBook.js @@ -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)