Add zoom hotkeys.

This commit is contained in:
Paul Chote
2019-12-07 17:09:29 +00:00
committed by tovl
parent 1dcb903580
commit 28dbda29e3
7 changed files with 37 additions and 4 deletions

View File

@@ -27,6 +27,9 @@ namespace OpenRA.Mods.Common.Widgets
readonly ModData modData;
readonly ResourceLayer resourceLayer;
public readonly HotkeyReference ZoomInKey = new HotkeyReference();
public readonly HotkeyReference ZoomOutKey = new HotkeyReference();
public readonly HotkeyReference ScrollUpKey = new HotkeyReference();
public readonly HotkeyReference ScrollDownKey = new HotkeyReference();
public readonly HotkeyReference ScrollLeftKey = new HotkeyReference();
@@ -423,6 +426,18 @@ namespace OpenRA.Mods.Common.Widgets
if (e.Event != KeyInputEvent.Down)
return false;
if (ZoomInKey.IsActivatedBy(e))
{
worldRenderer.Viewport.AdjustZoom(0.25f);
return true;
}
if (ZoomOutKey.IsActivatedBy(e))
{
worldRenderer.Viewport.AdjustZoom(-0.25f);
return true;
}
if (JumpToTopEdgeKey.IsActivatedBy(e))
{
worldRenderer.Viewport.Center(new WPos(worldRenderer.Viewport.CenterPosition.X, 0, 0));

View File

@@ -323,6 +323,8 @@ Container@EDITOR_WORLD_ROOT:
Width: WINDOW_RIGHT
Height: WINDOW_BOTTOM
IgnoreMouseOver: True
ZoomInKey: ZoomIn
ZoomOutKey: ZoomOut
ScrollUpKey: MapScrollUp
ScrollDownKey: MapScrollDown
ScrollLeftKey: MapScrollLeft

View File

@@ -77,6 +77,8 @@ Container@OBSERVER_WIDGETS:
Width: WINDOW_RIGHT
Height: WINDOW_BOTTOM
TooltipContainer: TOOLTIP_CONTAINER
ZoomInKey: ZoomIn
ZoomOutKey: ZoomOut
ScrollUpKey: MapScrollUp
ScrollDownKey: MapScrollDown
ScrollLeftKey: MapScrollLeft
@@ -1048,6 +1050,8 @@ Container@PLAYER_WIDGETS:
Height: WINDOW_BOTTOM
TooltipTemplate: WORLD_TOOLTIP_FACTIONSUFFIX
TooltipContainer: TOOLTIP_CONTAINER
ZoomInKey: ZoomIn
ZoomOutKey: ZoomOut
ScrollUpKey: MapScrollUp
ScrollDownKey: MapScrollDown
ScrollLeftKey: MapScrollLeft

View File

@@ -318,6 +318,8 @@ Container@EDITOR_WORLD_ROOT:
Width: WINDOW_RIGHT
Height: WINDOW_BOTTOM
IgnoreMouseOver: True
ZoomInKey: ZoomIn
ZoomOutKey: ZoomOut
ScrollUpKey: MapScrollUp
ScrollDownKey: MapScrollDown
ScrollLeftKey: MapScrollLeft

View File

@@ -42,6 +42,8 @@ Container@INGAME_ROOT:
Width: WINDOW_RIGHT
Height: WINDOW_BOTTOM
TooltipContainer: TOOLTIP_CONTAINER
ZoomInKey: ZoomIn
ZoomOutKey: ZoomOut
ScrollUpKey: MapScrollUp
ScrollDownKey: MapScrollDown
ScrollLeftKey: MapScrollLeft

View File

@@ -42,10 +42,6 @@ CycleStatusBars: COMMA
Description: Cycle status bars display
Types: World, Player, Spectator
ResetZoom: PERIOD
Description: Reset zoom
Types: World, Player, Spectator
ToggleMute: M
Description: Toggle audio mute
Types: World, Menu, Player, Spectator

View File

@@ -61,3 +61,15 @@ MapBookmarkSave04: R Ctrl
MapBookmarkRestore04: R Alt
Description: Jump to bookmark 4
Types: Viewport, Player, Spectator
ZoomIn: RIGHTBRACKET
Description: Zoom in
Types: Viewport, Player, Spectator
ZoomOut: LEFTBRACKET
Description: Zoom out
Types: Viewport, Player, Spectator
ResetZoom: PERIOD
Description: Reset zoom
Types: Viewport, Player, Spectator