Created
May 16, 2018 17:05
-
-
Save vjk2005/71f4dfc1e9892a65cc656b660cf28e90 to your computer and use it in GitHub Desktop.
Dynamically zoom-in on keypress to make close-quarters fighting easier on Airmash. Also adds a shortcut key for flag drops.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// press option key to zoom-in for close-quarters fighting | |
let zoom = false | |
document.onkeydown = e => { | |
if(e.key == 'Alt') { | |
zoom = true | |
e.stopPropagation() | |
e.preventDefault() | |
config.scalingFactor = 2000 | |
Graphics.resizeRenderer(window.innerWidth, window.innerHeight) | |
return false | |
} | |
// press y to drop | |
if(e.key == 'y') UI.parseCommand('/drop') | |
} | |
document.onkeyup = e => { | |
if(zoom && !e.altKey) { | |
config.scalingFactor = 5000 | |
Graphics.resizeRenderer(window.innerWidth, window.innerHeight) | |
zoom = false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment