cleanup readerui init for pdf

This commit is contained in:
chrox
2014-02-16 20:57:36 +08:00
parent 0eee130f5a
commit 1b55339186
2 changed files with 23 additions and 21 deletions

View File

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

View File

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