Add a keyboard shortcut to toggle topmenu visibility

This commit is contained in:
Kamil Chojnowski 2017-11-10 17:03:34 +01:00
parent 2095951e07
commit 483988f814
2 changed files with 20 additions and 2 deletions

View File

@ -51,6 +51,8 @@ function init()
pingLabel = topMenu:getChildById('pingLabel') pingLabel = topMenu:getChildById('pingLabel')
fpsLabel = topMenu:getChildById('fpsLabel') fpsLabel = topMenu:getChildById('fpsLabel')
g_keyboard.bindKeyDown('Ctrl+Shift+T', toggle)
if g_game.isOnline() then if g_game.isOnline() then
online() online()
end end
@ -164,3 +166,20 @@ end
function getTopMenu() function getTopMenu()
return topMenu return topMenu
end end
function toggle()
local menu = getTopMenu()
if not menu then
return
end
if menu:isVisible() then
menu:hide()
modules.client_background.getBackground():addAnchor(AnchorTop, 'parent', AnchorTop)
modules.game_interface.getRootPanel():addAnchor(AnchorTop, 'parent', AnchorTop)
else
menu:show()
modules.client_background.getBackground():addAnchor(AnchorTop, 'topMenu', AnchorBottom)
modules.game_interface.getRootPanel():addAnchor(AnchorTop, 'topMenu', AnchorBottom)
end
end

View File

@ -1,4 +1,3 @@
GameSidePanel < UIMiniWindowContainer GameSidePanel < UIMiniWindowContainer
image-source: /images/ui/panel_side image-source: /images/ui/panel_side
image-border: 4 image-border: 4