[feat] Two-column navigation (#3674)

New zoom configuration available among the others
Allows to easily navigate in two-column documents
In order to  work properly, **scroll mode must be deactivated**
The best zoom is obtained with proper cropping around the two columns (should be the default one for content-width)

Fixes #501
This commit is contained in:
FranMarelli
2018-02-10 14:58:39 +01:00
committed by Frans de Jonge
parent 0c7bba225f
commit 229c492979
2 changed files with 73 additions and 1 deletions

View File

@@ -63,6 +63,11 @@ function ReaderZooming:init()
doc = "zoom to fit content height",
event = "SetZoomMode", args = "contentheight"
},
ZoomToFitColumn = {
{ "Shift", "C" },
doc = "zoom to fit column",
event = "SetZoomMode", args = "colu"
},
}
end
if Device:isTouchDevice() then
@@ -226,7 +231,8 @@ function ReaderZooming:getZoom(pageno)
local page_size = self.ui.document:getNativePageDimensions(pageno)
if self.zoom_mode == "content"
or self.zoom_mode == "contentwidth"
or self.zoom_mode == "contentheight" then
or self.zoom_mode == "contentheight"
or self.zoom_mode == "column" then
local ubbox_dimen = self.ui.document:getUsedBBoxDimensions(pageno, 1)
-- if bbox is larger than the native page dimension render the full page
-- See discussion in koreader/koreader#970.
@@ -263,6 +269,8 @@ function ReaderZooming:getZoom(pageno)
end
elseif self.zoom_mode == "contentwidth" or self.zoom_mode == "pagewidth" then
zoom = zoom_w
elseif self.zoom_mode == "column" then
zoom = zoom_w * 2
elseif self.zoom_mode == "contentheight" or self.zoom_mode == "pageheight" then
zoom = zoom_h
elseif self.zoom_mode == "free" then
@@ -327,6 +335,7 @@ function ReaderZooming:addToMainMenu(menu_items)
checked_func = function() return self.zoom_mode == "contentheight" end,
callback = self:genSetZoomModeCallBack("contentheight"),
hold_callback = function() self:makeDefault("contentheight") end,
separator = true,
},
{
text = _("Zoom to fit page width"),
@@ -339,6 +348,13 @@ function ReaderZooming:addToMainMenu(menu_items)
checked_func = function() return self.zoom_mode == "pageheight" end,
callback = self:genSetZoomModeCallBack("pageheight"),
hold_callback = function() self:makeDefault("pageheight") end,
separator = true,
},
{
text = _("Zoom to fit column"),
checked_func = function() return self.zoom_mode == "column" end,
callback = self:genSetZoomModeCallBack("column"),
hold_callback = function() self:makeDefault("column") end,
},
{
text = _("Zoom to fit content"),