added a gamepad zoom reset button

This commit is contained in:
e7d 2016-11-11 01:31:45 +01:00
parent ba0f190a1a
commit f0e4d20513
2 changed files with 14 additions and 4 deletions

View File

@ -35,6 +35,10 @@
<th><kbd>-</kbd></th> <th><kbd>-</kbd></th>
<td>Zoom gamepad out</td> <td>Zoom gamepad out</td>
</tr> </tr>
<tr>
<th><kbd>0</kbd></th>
<td>Reset gamepad zoom</td>
</tr>
<tr> <tr>
<th><kbd>C</kbd></th> <th><kbd>C</kbd></th>
<td>Change active gamepad color</td> <td>Change active gamepad color</td>

View File

@ -64,6 +64,10 @@ function onKeyDown(e) {
case "Minus": case "Minus":
changeZoom("-"); changeZoom("-");
break; break;
case "Numpad0":
case "Digit0":
changeZoom("0");
break;
} }
} }
@ -256,14 +260,16 @@ function changeZoom(zoomLevel) {
return; return;
} }
if ('+' === zoomLevel && activeGamepadZoomLevel < 2) { if ('0' === zoomLevel) {
activeGamepadZoomLevel = 1;
}
else if ('+' === zoomLevel && activeGamepadZoomLevel < 2) {
activeGamepadZoomLevel += 0.1; activeGamepadZoomLevel += 0.1;
} }
if ('-' === zoomLevel && activeGamepadZoomLevel > 0.2) { else if ('-' === zoomLevel && activeGamepadZoomLevel > 0.2) {
activeGamepadZoomLevel -= 0.1; activeGamepadZoomLevel -= 0.1;
} }
else if (! isNaN(zoomLevel = parseFloat(zoomLevel))) {
if (! isNaN(zoomLevel = parseFloat(zoomLevel))) {
activeGamepadZoomLevel = zoomLevel; activeGamepadZoomLevel = zoomLevel;
} }