Merge pull request #513 from chrox/master

fix semi-auto cropping for djvu files
pull/514/head
Qingping Hou 10 years ago
commit 52ac2dc041

@ -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

@ -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

@ -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,
@ -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

@ -176,36 +176,36 @@ 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{
-- cropping controller
table.insert(self, ReaderCropping:new{
dialog = self.dialog,
view = self[1],
ui = self
ui = self,
document = self.document,
})
-- zooming controller
self.zoom = ReaderZooming:new{
local 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{
table.insert(self, zoom)
-- paging controller
table.insert(self, ReaderPaging:new{
dialog = self.dialog,
view = self[1],
ui = self
})
-- cropping controller
table.insert(self, ReaderCropping:new{
-- panning controller
table.insert(self, ReaderPanning:new{
dialog = self.dialog,
view = self[1],
ui = self,
document = self.document,
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,

@ -1 +1 @@
Subproject commit cf62f21087d511c2e9e4e852c2b4402a99bbdcfb
Subproject commit 1ef0dee5c0dbbbe812b8b5292c5a053f5d88fdcf
Loading…
Cancel
Save