From 77ba2b4f13af82531ad3593a84533ff9be7f9a12 Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Sat, 16 Apr 2016 21:35:21 +0200 Subject: [PATCH] Fix PixelDoubling not working properly after zooming with mousewheel I decided to write it this way (instead of setting `Game.Settings.Graphics.PixelDouble` in `Viewport.Zoom` appropriately) because I see the double pixel setting as the user's preference that the game uses at the start of a match and which should not be changed only because the user decided to zoom in a bit. --- .../Widgets/WorldInteractionControllerWidget.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs index 8954690abd..386033902e 100644 --- a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs @@ -345,8 +345,16 @@ namespace OpenRA.Widgets bool TogglePixelDouble() { - Game.Settings.Graphics.PixelDouble ^= true; - worldRenderer.Viewport.Zoom = Game.Settings.Graphics.PixelDouble ? 2 : 1; + if (worldRenderer.Viewport.Zoom == 1f) + worldRenderer.Viewport.Zoom = 2f; + else + { + // Reset zoom to regular view if it was anything else before + // (like a zoom level only reachable by using the scroll wheel). + worldRenderer.Viewport.Zoom = 1f; + } + + Game.Settings.Graphics.PixelDouble = worldRenderer.Viewport.Zoom == 2f; return true; }