QuickMenu: anchor to gesture position

Fixes: #10631
reviewable/pr10648/r1
yparitcher 11 months ago
parent 4b9de16c51
commit 27f7f1d5a9

@ -1016,7 +1016,7 @@ function Dispatcher:isActionEnabled(action)
return not disabled return not disabled
end end
function Dispatcher:_showAsMenu(settings) function Dispatcher:_showAsMenu(settings, gesture)
local display_list = Dispatcher:getDisplayList(settings) local display_list = Dispatcher:getDisplayList(settings)
local quickmenu local quickmenu
local buttons = {} local buttons = {}
@ -1041,6 +1041,7 @@ function Dispatcher:_showAsMenu(settings)
width_factor = 0.8, width_factor = 0.8,
use_info_style = false, use_info_style = false,
buttons = buttons, buttons = buttons,
anchor = function() return gesture and gesture.pos end,
} }
UIManager:show(quickmenu) UIManager:show(quickmenu)
end end
@ -1053,7 +1054,7 @@ arguments are:
--]]-- --]]--
function Dispatcher:execute(settings, gesture) function Dispatcher:execute(settings, gesture)
if settings.settings ~= nil and settings.settings.show_as_quickmenu == true then if settings.settings ~= nil and settings.settings.show_as_quickmenu == true then
return Dispatcher:_showAsMenu(settings) return Dispatcher:_showAsMenu(settings, gesture)
end end
local has_many = Dispatcher:_itemsCount(settings) > 1 local has_many = Dispatcher:_itemsCount(settings) > 1
if has_many then if has_many then

Loading…
Cancel
Save