2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00

Merge pull request #574 from kai771/fcw_bugfix

bugfixes for fit-to-content-width zoom mode for documents with pages of ...
This commit is contained in:
Tigran Aivazian 2012-11-13 12:52:17 -08:00
commit 8f28fe8825

View File

@ -1324,18 +1324,22 @@ function UniReader:setzoom(page, preCache)
self.offset_y = -1 * y0 * self.globalzoom
self.content_top = self.offset_y
-- enable pan mode in ZOOM_FIT_TO_CONTENT_WIDTH
if self.globalzoom * pheight > height then
self.globalzoom_mode = self.ZOOM_FIT_TO_CONTENT_WIDTH_PAN
end
elseif self.globalzoom_mode == self.ZOOM_FIT_TO_CONTENT_WIDTH_PAN then
if self.content_top == -2012 then
-- We must handle previous page turn as a special cases,
-- because we want to arrive at the bottom of previous page.
-- Since this a real page turn, we need to recalculate stuff.
if (x1 - x0) < pwidth then
self.globalzoom = width / (x1 - x0)
end
if self.globalzoom * pheight > height then
self.offset_x = -1 * x0 * self.globalzoom
self.content_top = -1 * y0 * self.globalzoom
self.offset_y = fb.bb:getHeight() - self.fullheight
else
self.globalzoom_mode = self.ZOOM_FIT_TO_CONTENT_WIDTH
end
end
elseif self.globalzoom_mode == self.ZOOM_FIT_TO_CONTENT_HEIGHT then
if (y1 - y0) < pheight then