From fd60afd97e917d6a70d68de598a979506faaf0a1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 4 Aug 2016 05:22:04 +0530 Subject: [PATCH] E-book viewer: Fix 0px margins not being respected when the option to override book margins is turned off. See #1608458 (ebook viewer: epub page margins bigger each chapter) --- resources/compiled_coffeescript.zip | Bin 101192 -> 101460 bytes src/calibre/ebooks/oeb/display/paged.coffee | 11 ++++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/resources/compiled_coffeescript.zip b/resources/compiled_coffeescript.zip index ed1efb290d1474852be02a7136176d700102ccc8..a000d7c1684528019e5b30962bc1ec891a32b537 100644 GIT binary patch delta 385 zcmX>xjqS<|whiC+3Qp5v@m%x7#UeY0fdPc2Cp&hFO`qS+$gx>%-)CViMO#~iywaQ; z1^dYh&x^B`HW6%18uw zv$8P&0Vfd7Wny6X)W*oLo~c@Cx??+|?DXlKjLu-s>L^($C>fg=CYq;Mm?Rn{o2Hni zCYhR87^Iq7nkAZ8rX;3XngcH#*C#70i zrlgt~n3|+nn4}~bnVVRc8mA;DCz_fjPXEx!C_Xtik!$+xZbql+FS;0gr_b(Uv|y|S E0P1ID^#A|> diff --git a/src/calibre/ebooks/oeb/display/paged.coffee b/src/calibre/ebooks/oeb/display/paged.coffee index d3a88183c5..88d7090d58 100644 --- a/src/calibre/ebooks/oeb/display/paged.coffee +++ b/src/calibre/ebooks/oeb/display/paged.coffee @@ -107,9 +107,14 @@ class PagedDisplay set_geometry: (cols_per_screen=1, margin_top=20, margin_side=40, margin_bottom=20) -> this.cols_per_screen = cols_per_screen if this.use_document_margins and this.document_margins != null - this.margin_top = this.document_margins.top or margin_top - this.margin_bottom = this.document_margins.bottom or margin_bottom - this.margin_side = this.document_margins.left or this.document_margins.right or margin_side + this.margin_top = if this.document_margins.top != null then this.document_margins.top else margin_top + this.margin_bottom = if this.document_margins.bottom != null then this.document_margins.bottom else margin_bottom + if this.document_margins.left != null + this.margin_side = this.document_margins.left + else if this.document_margins.right != null + this.margin_side = this.document_margins.right + else + this.margin_side = margin_side this.effective_margin_top = this.margin_top this.effective_margin_bottom = this.margin_bottom else