@@ -384,25 +384,34 @@ void Mouse::checkForDrag()
384384// -------------------------------------------------------------------------------------------------
385385/* * Check for mouse click, using allowed drag forgiveness */
386386// -------------------------------------------------------------------------------------------------
387- Bool Mouse::isClick (const ICoord2D *anchor , const ICoord2D *dest , UnsignedInt previousMouseClick , UnsignedInt currentMouseClick )
387+ Bool Mouse::isClick (const ICoord2D &mouseAnchor0 , const ICoord2D &mouseAnchor1 , UnsignedInt mouseClickTimeMs0 , UnsignedInt mouseClickTimeMs1 )
388388{
389- ICoord2D delta;
390- delta.x = anchor->x - dest->x ;
391- delta.y = anchor->y - dest->y ;
389+ const ICoord2D mouseAnchorDelta = mouseAnchor1 - mouseAnchor0;
390+ const UnsignedInt timeMsDelta = mouseClickTimeMs1 - mouseClickTimeMs0;
392391
392+ // TheSuperHackers @bugfix Use the adjusted drag tolerance to prevent too far tolerances with high scroll factors,
393+ // because higher scroll speeds will travel further by the delta.
394+ const Real dragTolerance = getDragToleranceAdjustedForScrollFactor ();
393395
394- // if the mouse hasn't moved further than the tolerance distance
395- // or the click took less than the tolerance duration
396- if ( abs (delta.x ) > m_dragTolerance
397- || abs (delta.y ) > m_dragTolerance
398- || currentMouseClick - previousMouseClick > m_dragToleranceMS)
396+ // If the click took less than the tolerance duration
397+ // or the mouse hasn't moved further than the tolerance distance
398+ // TheSuperHackers @bugfix Now compares the distance in a circle instead of a rectangle.
399+ if ( timeMsDelta > m_dragToleranceMS || mouseAnchorDelta.lengthSqr () > sqr (m_dragTolerance) )
399400 {
400401 return FALSE ;
401402 }
402403 return TRUE ;
403404}
404405
405406
407+ // -------------------------------------------------------------------------------------------------
408+ /* * Get the scroll speed factor adjusted drag tolerance */
409+ // -------------------------------------------------------------------------------------------------
410+ Real Mouse::getDragToleranceAdjustedForScrollFactor () const
411+ {
412+ return m_dragTolerance * (TheGlobalData->m_keyboardDefaultScrollFactor / TheGlobalData->m_keyboardScrollFactor );
413+ }
414+
406415
407416// /////////////////////////////////////////////////////////////////////////////////////////////////
408417// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////////////////////////
0 commit comments