implemented vertical alignment for comics in manual mode
This commit is contained in:
parent
e57784f1a1
commit
f6b3824fc2
1 changed files with 8 additions and 3 deletions
11
scripts.js
11
scripts.js
|
@ -20,7 +20,6 @@ window.onload = function() {
|
|||
|
||||
book = new ComicBook("comic", pages, options);
|
||||
book.draw();
|
||||
book.zoom(.5);
|
||||
}
|
||||
|
||||
window.onresize = function() {
|
||||
|
@ -160,11 +159,17 @@ function ComicBook(id, srcs, opts) {
|
|||
if (canvas_width < window.innerWidth && options.zoomMode == "manual") {
|
||||
offsetW = (window.innerWidth - page_width) / 2;
|
||||
if (options.displayMode == "double") offsetW = offsetW - page_width / 2;
|
||||
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// draw the page(s)
|
||||
context.drawImage(page, offsetW, 0, page_width, page_height);
|
||||
if (options.displayMode == "double" && typeof page2 == "object") context.drawImage(page2, page_width + offsetW, 0, page_width, page_height);
|
||||
context.drawImage(page, offsetW, offsetH, page_width, page_height);
|
||||
if (options.displayMode == "double" && typeof page2 == "object") context.drawImage(page2, page_width + offsetW, offsetH, page_width, page_height);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue