From 9e35f6011096da53b2b881fd9b9202246c3826ec Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 19 Feb 2010 08:23:07 +1300 Subject: [PATCH] fixed scrolling --- OpenRa.Game/Game.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/OpenRa.Game/Game.cs b/OpenRa.Game/Game.cs index b78e503c30..7bd3bfde46 100644 --- a/OpenRa.Game/Game.cs +++ b/OpenRa.Game/Game.cs @@ -287,10 +287,21 @@ namespace OpenRa return sp; } + static int2 lastPos; public static void DispatchMouseInput(MouseInputEvent ev, MouseEventArgs e, Keys ModifierKeys) { int sync = Game.world.SyncHash(); + if (ev == MouseInputEvent.Down) + lastPos = new int2(e.Location); + + if (ev == MouseInputEvent.Move && (e.Button == MouseButtons.Middle || e.Button == (MouseButtons.Left | MouseButtons.Right))) + { + var p = new int2(e.Location); + viewport.Scroll(lastPos - p); + lastPos = p; + } + Game.viewport.DispatchMouseInput( world, new MouseInput {