Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Core/GameEngine/Include/GameClient/Mouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 13 additions & 2 deletions Core/GameEngine/Source/GameClient/Input/Mouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Comment thread
xezon marked this conversation as resolved.
}


///////////////////////////////////////////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////////////////////////
Expand Down
Loading