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 | Adds getDragToleranceAdjustedForScrollFactor() and wires it into isClick(); formula is mathematically correct and the integer-to-float promotion for the comparison is safe. |
| Core/GameEngine/Include/GameClient/Mouse.h | Adds the getDragToleranceAdjustedForScrollFactor() declaration; no structural concerns. |
| Core/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp | Removes the camera-position drift check from right-click deselect detection; correctly updates the comment to reflect only two remaining suppression conditions. |
| Core/GameEngine/Include/GameClient/SelectionXlat.h | Removes the m_deselectDownCameraPosition member now that the camera-drift check is gone; no remaining references. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[MSG_RAW_MOUSE_RIGHT_BUTTON_DOWN] --> B[Record anchor pixel position\nRecord timestamp]
A --> C["~~Record 3D camera position~~\n(removed)"]
style C stroke:#f66,stroke-dasharray:5 5,color:#f66
D[MSG_RAW_MOUSE_RIGHT_BUTTON_UP] --> E[Read current pixel position\nRead current timestamp]
E --> F["isClick(anchor, current, t0, t1)"]
F --> G["dragTolerance =\nm_dragTolerance x (defaultScrollFactor / currentScrollFactor)"]
G --> H{"abs(dx) > dragTolerance\nOR abs(dy) > dragTolerance\nOR elapsed > dragToleranceMS?"}
H -- Yes --> I[Not a click - ignore deselect]
H -- No --> J[Click detected - deselect / cancel GUI]
%%{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[MSG_RAW_MOUSE_RIGHT_BUTTON_DOWN] --> B[Record anchor pixel position\nRecord timestamp]
A --> C["~~Record 3D camera position~~\n(removed)"]
style C stroke:#f66,stroke-dasharray:5 5,color:#f66
D[MSG_RAW_MOUSE_RIGHT_BUTTON_UP] --> E[Read current pixel position\nRead current timestamp]
E --> F["isClick(anchor, current, t0, t1)"]
F --> G["dragTolerance =\nm_dragTolerance x (defaultScrollFactor / currentScrollFactor)"]
G --> H{"abs(dx) > dragTolerance\nOR abs(dy) > dragTolerance\nOR elapsed > dragToleranceMS?"}
H -- Yes --> I[Not a click - ignore deselect]
H -- No --> J[Click detected - deselect / cancel GUI]
Reviews (2): Last reviewed commit: "Remove legacy m_deselectDownCameraPositi..." | 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.
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.