diff --git a/Core/GameEngine/Include/GameClient/Mouse.h b/Core/GameEngine/Include/GameClient/Mouse.h index 849a933f37f..4ba50e63e17 100644 --- a/Core/GameEngine/Include/GameClient/Mouse.h +++ b/Core/GameEngine/Include/GameClient/Mouse.h @@ -323,6 +323,8 @@ class Mouse : public SubsystemInterface Bool isClick(const ICoord2D *anchor, const ICoord2D *dest, UnsignedInt previousMouseClick, UnsignedInt currentMouseClick); + Real getDragToleranceAdjustedForScrollFactor() const; + AsciiString m_tooltipFontName; ///< tooltip font Int m_tooltipFontSize; ///< tooltip font Bool m_tooltipFontIsBold; ///< tooltip font diff --git a/Core/GameEngine/Include/GameClient/SelectionXlat.h b/Core/GameEngine/Include/GameClient/SelectionXlat.h index cdb6f56698b..bdeef4039d5 100644 --- a/Core/GameEngine/Include/GameClient/SelectionXlat.h +++ b/Core/GameEngine/Include/GameClient/SelectionXlat.h @@ -53,8 +53,6 @@ class SelectionTranslator : public GameMessageTranslator SelectCountMap m_selectCountMap; - Coord3D m_deselectDownCameraPosition; - Bool selectFriends( Drawable *draw, GameMessage *createTeamMsg, Bool dragSelecting ); Bool killThemKillThemAll( Drawable *draw, GameMessage *killThemAllMsg ); diff --git a/Core/GameEngine/Source/GameClient/Input/Mouse.cpp b/Core/GameEngine/Source/GameClient/Input/Mouse.cpp index a1c2cb97a4e..ece0698d142 100644 --- a/Core/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/Core/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -390,11 +390,14 @@ Bool Mouse::isClick(const ICoord2D *anchor, const ICoord2D *dest, UnsignedInt pr delta.x = anchor->x - dest->x; delta.y = anchor->y - dest->y; + // TheSuperHackers @bugfix Use the adjusted drag tolerance to prevent too far tolerances with high scroll factors, + // because higher scroll speeds will travel further by the delta. + const Real dragTolerance = getDragToleranceAdjustedForScrollFactor(); // if the mouse hasn't moved further than the tolerance distance // or the click took less than the tolerance duration - if ( abs(delta.x) > m_dragTolerance - || abs(delta.y) > m_dragTolerance + if ( abs(delta.x) > dragTolerance + || abs(delta.y) > dragTolerance || currentMouseClick - previousMouseClick > m_dragToleranceMS) { return FALSE; @@ -403,6 +406,14 @@ Bool Mouse::isClick(const ICoord2D *anchor, const ICoord2D *dest, UnsignedInt pr } +//------------------------------------------------------------------------------------------------- +/** Get the scroll speed factor adjusted drag tolerance */ +//------------------------------------------------------------------------------------------------- +Real Mouse::getDragToleranceAdjustedForScrollFactor() const +{ + return m_dragTolerance * (TheGlobalData->m_keyboardDefaultScrollFactor / TheGlobalData->m_keyboardScrollFactor); +} + /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// diff --git a/Core/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/Core/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp index caca08f832a..79f5723430f 100644 --- a/Core/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp +++ b/Core/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp @@ -264,7 +264,6 @@ SelectionTranslator::SelectionTranslator() m_deselectFeedbackAnchor.x = 0; m_deselectFeedbackAnchor.y = 0; m_lastClick = 0; - m_deselectDownCameraPosition.zero(); m_displayedMaxWarning = FALSE; m_selectCountMap.clear(); @@ -942,13 +941,11 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa //----------------------------------------------------------------------------- case GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_DOWN: { - // There are three ways in which we can ignore this as a deselect: + // There are two ways in which we can ignore this as a deselect: // 1) 2-D position on screen // 2) Time has exceeded the time which we allow for this to be a click. - // 3) 3-D camera position has changed m_deselectFeedbackAnchor = msg->getArgument( 0 )->pixel; m_lastClick = (UnsignedInt) msg->getArgument( 2 )->integer; - m_deselectDownCameraPosition = TheTacticalView->getPosition(); break; } @@ -956,9 +953,6 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa //----------------------------------------------------------------------------- case GameMessage::MSG_RAW_MOUSE_RIGHT_BUTTON_UP: { - Coord3D cameraPos = TheTacticalView->getPosition(); - cameraPos.sub(&m_deselectDownCameraPosition); - ICoord2D pixel = msg->getArgument( 0 )->pixel; UnsignedInt currentTime = (UnsignedInt) msg->getArgument( 2 )->integer;