mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
QuickMenu: anchor to gesture position 3 (#10646)
This commit is contained in:
@@ -244,6 +244,56 @@ function Gestures:genMenu(ges)
|
||||
end,
|
||||
})
|
||||
Dispatcher:addSubMenu(self, sub_items, self.gestures, ges)
|
||||
table.insert(sub_items, {
|
||||
text = _("Anchor QuickMenu to gesture position"),
|
||||
checked_func = function()
|
||||
return self.gestures[ges] ~= nil
|
||||
and self.gestures[ges].settings ~= nil
|
||||
and self.gestures[ges].settings.anchor_quickmenu
|
||||
end,
|
||||
callback = function()
|
||||
if self.gestures[ges] then
|
||||
if self.gestures[ges].settings then
|
||||
if self.gestures[ges].settings.anchor_quickmenu then
|
||||
self.gestures[ges].settings.anchor_quickmenu = nil
|
||||
if next(self.gestures[ges].settings) == nil then
|
||||
self.gestures[ges].settings = nil
|
||||
end
|
||||
else
|
||||
self.gestures[ges].settings.anchor_quickmenu = true
|
||||
end
|
||||
else
|
||||
self.gestures[ges].settings = {["anchor_quickmenu"] = true}
|
||||
end
|
||||
self.updated = true
|
||||
end
|
||||
end,
|
||||
})
|
||||
table.insert(sub_items, {
|
||||
text = _("Always active"),
|
||||
checked_func = function()
|
||||
return self.gestures[ges] ~= nil
|
||||
and self.gestures[ges].settings ~= nil
|
||||
and self.gestures[ges].settings.always_active
|
||||
end,
|
||||
callback = function()
|
||||
if self.gestures[ges] then
|
||||
if self.gestures[ges].settings then
|
||||
if self.gestures[ges].settings.always_active then
|
||||
self.gestures[ges].settings.always_active = nil
|
||||
if next(self.gestures[ges].settings) == nil then
|
||||
self.gestures[ges].settings = nil
|
||||
end
|
||||
else
|
||||
self.gestures[ges].settings.always_active = true
|
||||
end
|
||||
else
|
||||
self.gestures[ges].settings = {["always_active"] = true}
|
||||
end
|
||||
self.updated = true
|
||||
end
|
||||
end,
|
||||
})
|
||||
return sub_items
|
||||
end
|
||||
|
||||
@@ -1103,6 +1153,7 @@ function Gestures:gestureAction(action, ges)
|
||||
return
|
||||
else
|
||||
self.ui:handleEvent(Event:new("HandledAsSwipe"))
|
||||
ges.anchor_quickmenu = action_list.settings and action_list.settings.anchor_quickmenu
|
||||
Dispatcher:execute(action_list, ges)
|
||||
end
|
||||
return true
|
||||
|
||||
@@ -259,8 +259,8 @@ function Profiles:getSubMenuItems()
|
||||
return sub_item_table
|
||||
end
|
||||
|
||||
function Profiles:onProfileExecute(name)
|
||||
Dispatcher:execute(self.data[name])
|
||||
function Profiles:onProfileExecute(name, gesture)
|
||||
Dispatcher:execute(self.data[name], gesture)
|
||||
end
|
||||
|
||||
function Profiles:editProfileName(editCallback, old_name)
|
||||
@@ -271,6 +271,7 @@ function Profiles:editProfileName(editCallback, old_name)
|
||||
buttons = {{
|
||||
{
|
||||
text = _("Cancel"),
|
||||
id = "close",
|
||||
callback = function()
|
||||
UIManager:close(name_input)
|
||||
end,
|
||||
|
||||
Reference in New Issue
Block a user