From b1acbb244693131010a994e03f6c9ae232749242 Mon Sep 17 00:00:00 2001 From: chrox Date: Sun, 16 Feb 2014 19:42:50 +0800 Subject: [PATCH 1/4] make overlap pixels configurable --- defaults.lua | 3 +++ frontend/ui/reader/readerpaging.lua | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/defaults.lua b/defaults.lua index 26ec2f5c0..99909d8d1 100644 --- a/defaults.lua +++ b/defaults.lua @@ -53,6 +53,9 @@ DSHOWFILESIZE = false -- default to true, set to false for counterclockwise rotation DLANDSCAPE_CLOCKWISE_ROTATION = true +-- page overlap pixels +DOVERLAPPIXELS = 30 + -- customizable tap zones(rectangles) -- x: x coordinate of top left corner in proportion of screen width -- y: y coordinate of top left corner in proportion of screen height diff --git a/frontend/ui/reader/readerpaging.lua b/frontend/ui/reader/readerpaging.lua index 56b5dbc1c..ccc661fbd 100644 --- a/frontend/ui/reader/readerpaging.lua +++ b/frontend/ui/reader/readerpaging.lua @@ -17,7 +17,7 @@ local ReaderPaging = InputContainer:new{ visible_area = nil, page_area = nil, show_overlap_enable = nil, - overlap = Screen:scaleByDPI(30), + overlap = Screen:scaleByDPI(DOVERLAPPIXELS), page_flipping_mode = false, bookmark_flipping_mode = false, From 0eee130f5af971fbfdd1b9524084150e11ca79c9 Mon Sep 17 00:00:00 2001 From: chrox Date: Sun, 16 Feb 2014 19:49:18 +0800 Subject: [PATCH 2/4] clipping page bbox --- frontend/document/document.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/document/document.lua b/frontend/document/document.lua index e74ad5bc9..c5ec407cc 100644 --- a/frontend/document/document.lua +++ b/frontend/document/document.lua @@ -150,9 +150,13 @@ This method returns pagesize if bbox is corrupted --]] function Document:getUsedBBoxDimensions(pageno, zoom, rotation) local bbox = self:getPageBBox(pageno) + -- clipping page bbox + if bbox.x0 < 0 then bbox.x0 = 0 end + if bbox.y0 < 0 then bbox.y0 = 0 end + if bbox.x1 < 0 then bbox.x1 = 0 end + if bbox.y1 < 0 then bbox.y1 = 0 end local ubbox_dimen = nil - if (bbox.x0 < 0) or (bbox.y0 < 0) or (bbox.x1 < 0) or (bbox.y1 < 0) - or (bbox.x0 == bbox.x1) or (bbox.y0 == bbox.y1) then + if (bbox.x0 > bbox.x1) or (bbox.y0 > bbox.y1) then -- if document's bbox info is corrupted, we use the page size ubbox_dimen = self:getPageDimensions(pageno, zoom, rotation) else From 1b55339186ee8a9e156752c17772cd3fb694b299 Mon Sep 17 00:00:00 2001 From: chrox Date: Sun, 16 Feb 2014 20:57:36 +0800 Subject: [PATCH 3/4] cleanup readerui init for pdf --- frontend/ui/reader/readerpaging.lua | 4 ++- frontend/ui/readerui.lua | 40 ++++++++++++++--------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/frontend/ui/reader/readerpaging.lua b/frontend/ui/reader/readerpaging.lua index ccc661fbd..48d7f48a7 100644 --- a/frontend/ui/reader/readerpaging.lua +++ b/frontend/ui/reader/readerpaging.lua @@ -400,8 +400,9 @@ function ReaderPaging:getTopPage() end function ReaderPaging:onInitScrollPageStates(orig) + --DEBUG.traceback() DEBUG("init scroll page states", orig) - if self.view.page_scroll then + if self.view.page_scroll and self.view.state.page then self.orig_page = self.current_page self.view.page_states = {} local blank_area = Geom:new{} @@ -734,6 +735,7 @@ end -- wrapper for bounds checking function ReaderPaging:gotoPage(number, orig) + --DEBUG.traceback() if number == self.current_page or not number then return true end diff --git a/frontend/ui/readerui.lua b/frontend/ui/readerui.lua index 95ab3d1ea..d40be38de 100644 --- a/frontend/ui/readerui.lua +++ b/frontend/ui/readerui.lua @@ -176,25 +176,6 @@ function ReaderUI:init() end -- for page specific controller if self.document.info.has_pages then - -- if needed, insert a paging container - table.insert(self, ReaderPaging:new{ - dialog = self.dialog, - view = self[1], - ui = self - }) - -- zooming controller - self.zoom = ReaderZooming:new{ - dialog = self.dialog, - view = self[1], - ui = self - } - table.insert(self, self.zoom) -- hold reference to zoom controller - -- panning controller - table.insert(self, ReaderPanning:new{ - dialog = self.dialog, - view = self[1], - ui = self - }) -- cropping controller table.insert(self, ReaderCropping:new{ dialog = self.dialog, @@ -202,10 +183,29 @@ function ReaderUI:init() ui = self, document = self.document, }) + -- zooming controller + local zoom = ReaderZooming:new{ + dialog = self.dialog, + view = self[1], + ui = self + } + table.insert(self, zoom) + -- paging controller + table.insert(self, ReaderPaging:new{ + dialog = self.dialog, + view = self[1], + ui = self + }) + -- panning controller + table.insert(self, ReaderPanning:new{ + dialog = self.dialog, + view = self[1], + ui = self + }) -- hinting controller table.insert(self, ReaderHinting:new{ dialog = self.dialog, - zoom = self.zoom, + zoom = zoom, view = self[1], ui = self, document = self.document, From c9784a84b3e2a3905e2b3a67b6f021b67f4a98e9 Mon Sep 17 00:00:00 2001 From: chrox Date: Sun, 16 Feb 2014 21:32:48 +0800 Subject: [PATCH 4/4] fix semi-auto cropping for djvu files --- koreader-base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koreader-base b/koreader-base index cf62f2108..1ef0dee5c 160000 --- a/koreader-base +++ b/koreader-base @@ -1 +1 @@ -Subproject commit cf62f21087d511c2e9e4e852c2b4402a99bbdcfb +Subproject commit 1ef0dee5c0dbbbe812b8b5292c5a053f5d88fdcf