Minimap navigation with Alt hotkeys

master
Eduardo Bart 11 years ago
parent 4351f3c63f
commit 9f69c71b6d

@ -41,6 +41,11 @@ function init()
minimapWidget.onMouseWheel = onMinimapMouseWheel
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()
minimapWindow:setup()
loadMapFlags()
@ -322,6 +327,14 @@ function compassClick(self, mousePos, mouseButton, elapsed)
updateMapFlags()
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()
minimapWidget:zoomIn()
end

Loading…
Cancel
Save