From 53abfb7932a5487fbee9aab321c0e65c8ceab9cc Mon Sep 17 00:00:00 2001 From: nehalmistry <> Date: Fri, 25 Apr 2003 16:33:58 +0000 Subject: [PATCH] fix up middle-click mouse scroll --- src/ui/mouse.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/ui/mouse.cpp b/src/ui/mouse.cpp index 4e3368dce..506a7368a 100644 --- a/src/ui/mouse.cpp +++ b/src/ui/mouse.cpp @@ -648,17 +648,32 @@ global void UIHandleMouseMove(int x,int y) if( KeyModifiers&ModifierControl ) { scroll=2; } else { - scroll=4; + scroll=1; } +#ifdef WIN32 + scroll*=2; +#endif + xo = TheUI.MouseViewport->MapX; yo = TheUI.MouseViewport->MapY; if( TheUI.ReverseMouseMove ) { - xo+=(CursorStartX-x)/scroll; - yo+=(CursorStartY-y)/scroll; + if (x < CursorStartX) { + xo+=scroll; + } else if (x > CursorStartX) { + xo-=scroll; + } } else { - xo+=(x-CursorStartX)/scroll; - yo+=(y-CursorStartY)/scroll; + if (x < CursorStartX) { + xo-=scroll; + } else if (x > CursorStartX) { + xo+=scroll; + } + if (y < CursorStartY) { + yo-=scroll; + } else if (y > CursorStartY) { + yo+=scroll; + } } TheUI.WarpX=CursorStartX; TheUI.WarpY=CursorStartY;