mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge pull request #638 from houqp/new_ui_code_fix
zoom mode support in reader menu & menu module bug fix
This commit is contained in:
@@ -21,6 +21,12 @@ function ReaderMenu:init()
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderMenu:genSetZoomModeCallBack(mode)
|
||||
return function()
|
||||
self.ui:handleEvent(Event:new("SetZoomMode", mode))
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderMenu:onShowMenu()
|
||||
local item_table = {}
|
||||
|
||||
@@ -31,14 +37,16 @@ function ReaderMenu:onShowMenu()
|
||||
text = "rotate 90 degree clockwise",
|
||||
callback = function()
|
||||
Screen:screenRotate("clockwise")
|
||||
self.ui:handleEvent(Event:new("SetDimensions", Screen:getSize()))
|
||||
self.ui:handleEvent(
|
||||
Event:new("SetDimensions", Screen:getSize()))
|
||||
end
|
||||
},
|
||||
{
|
||||
text = "rotate 90 degree anticlockwise",
|
||||
callback = function()
|
||||
Screen:screenRotate("anticlockwise")
|
||||
self.ui:handleEvent(Event:new("SetDimensions", Screen:getSize()))
|
||||
self.ui:handleEvent(
|
||||
Event:new("SetDimensions", Screen:getSize()))
|
||||
end
|
||||
},
|
||||
}
|
||||
@@ -50,9 +58,27 @@ function ReaderMenu:onShowMenu()
|
||||
sub_item_table = {
|
||||
{
|
||||
text = "Zoom to fit content width",
|
||||
callback = self:genSetZoomModeCallBack("contentwidth")
|
||||
},
|
||||
{
|
||||
text = "Zoom to fit content height",
|
||||
callback = self:genSetZoomModeCallBack("contentheight")
|
||||
},
|
||||
{
|
||||
text = "Zoom to fit page width",
|
||||
callback = self:genSetZoomModeCallBack("pagewidth")
|
||||
},
|
||||
{
|
||||
text = "Zoom to fit page height",
|
||||
callback = self:genSetZoomModeCallBack("pageheight")
|
||||
},
|
||||
{
|
||||
text = "Zoom to fit content",
|
||||
callback = self:genSetZoomModeCallBack("content")
|
||||
},
|
||||
{
|
||||
text = "Zoom to fit page",
|
||||
callback = self:genSetZoomModeCallBack("page")
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user