Minimap navigation with Alt hotkeys

This commit is contained in:
Eduardo Bart 2013-01-26 20:20:26 -02:00
parent 4351f3c63f
commit 9f69c71b6d
1 changed files with 13 additions and 0 deletions

View File

@ -41,6 +41,11 @@ function init()
minimapWidget.onMouseWheel = onMinimapMouseWheel minimapWidget.onMouseWheel = onMinimapMouseWheel
flagsPanel = minimapWindow:recursiveGetChildById('flagsPanel') flagsPanel = minimapWindow:recursiveGetChildById('flagsPanel')
g_keyboard.bindKeyPress('Alt+Left', function() move(-1,0) end)
g_keyboard.bindKeyPress('Alt+Right', function() move(1,0) end)
g_keyboard.bindKeyPress('Alt+Up', function() move(0,-1) end)
g_keyboard.bindKeyPress('Alt+Down', function() move(0,1) end)
reset() reset()
minimapWindow:setup() minimapWindow:setup()
loadMapFlags() loadMapFlags()
@ -322,6 +327,14 @@ function compassClick(self, mousePos, mouseButton, elapsed)
updateMapFlags() updateMapFlags()
end end
function move(x,y)
local speed = math.ceil((1.0 / minimapWidget:getScale()) * 3)
local cameraPos = minimapWidget:getCameraPosition()
local pos = {x = cameraPos.x + x*speed, y = cameraPos.y + y*speed, z = cameraPos.z}
minimapWidget:setCameraPosition(pos)
updateMapFlags()
end
function miniMapZoomIn() function miniMapZoomIn()
minimapWidget:zoomIn() minimapWidget:zoomIn()
end end