bugfix(mouse): Fix bad drag tolerances with high scroll speed factors#2823
bugfix(mouse): Fix bad drag tolerances with high scroll speed factors#2823xezon wants to merge 2 commits into
Conversation
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Source/GameClient/Input/Mouse.cpp | Core fix: isClick now uses sqr(dragTolerance) (scroll-factor-adjusted) instead of raw m_dragTolerance; adds getDragToleranceAdjustedForScrollFactor() helper. Logic is correct. |
| Core/Libraries/Include/Lib/BaseType.h | Adds arithmetic operators and lengthSqr() to coordinate structs. All implementations are symmetric, consistent, and correctly delegate to add()/sub() member methods. |
| Core/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp | Removes m_deselectDownCameraPosition 3D-camera-position guard from right-click deselect; updates isClick call to reference syntax. Simplification is intentional and consistent with the new tolerance model. |
| Core/GameEngine/Include/GameClient/SelectionXlat.h | Removes unused m_deselectDownCameraPosition member declaration, matching the implementation cleanup in SelectionXlat.cpp. |
| Core/GameEngine/Include/GameClient/Mouse.h | Updates isClick declaration to use const-reference parameters and adds public getDragToleranceAdjustedForScrollFactor() declaration. Clean header change. |
| Core/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp | Two isClick call sites updated from address-of pointer syntax to direct reference passing — mechanical update only. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Mouse RIGHT_BUTTON_UP event] --> B[Collect mouseAnchorDelta]
B --> C[Compute timeMsDelta]
C --> D[getDragToleranceAdjustedForScrollFactor]
D --> E{timeMsDelta > m_dragToleranceMS OR lengthSqr > sqr dragTolerance}
E -- Yes --> F[return FALSE - treat as drag]
E -- No --> G[return TRUE - registered as click]
G --> H1[CommandXlat: place/cancel build]
G --> H2[SelectionXlat: deselect all units]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[Mouse RIGHT_BUTTON_UP event] --> B[Collect mouseAnchorDelta]
B --> C[Compute timeMsDelta]
C --> D[getDragToleranceAdjustedForScrollFactor]
D --> E{timeMsDelta > m_dragToleranceMS OR lengthSqr > sqr dragTolerance}
E -- Yes --> F[return FALSE - treat as drag]
E -- No --> G[return TRUE - registered as click]
G --> H1[CommandXlat: place/cancel build]
G --> H2[SelectionXlat: deselect all units]
Reviews (6): Last reviewed commit: "bugfix(mouse): Fix bad drag tolerances w..." | Re-trigger Greptile
|
#1501 Seems related. Maybe using |
In principle yes, but that would require to be a reasonable value and the arguments of the isClick function to take in world positions instead of mouse positions.
It looks related yes. |
Skyaero42
left a comment
There was a problem hiding this comment.
I think for now this is a sufficient fix.
2cecc31 to
a2f38ca
Compare
a2f38ca to
8ca8f81
Compare
8ca8f81 to
b7b643d
Compare
…oord3D, ICoord2D, ICoord3D (#2823)
b7b643d to
6340d13
Compare
Merge with Rebase
This change fixes the bad drag tolerances with high scroll speed factors, which was introduced by #1501 and is especially pronounced in this Project because players are encouraged to set way higher scroll factors after #1026 when higher frame rates no longer increase the camera movement.
TODO