bugfix(mouse): Fix bad drag tolerances with high scroll speed factors, alternative#2826
Conversation
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Source/GameClient/Input/Mouse.cpp | isClick refactored to accept both 2D mouse anchors and 3D camera positions; switch from rectangular to circular pixel tolerance; new 3D camera delta check added |
| Core/GameEngine/Include/GameClient/Mouse.h | isClick signature updated to pass anchors and camera positions by const-ref; m_dragTolerance3D already existed as UnsignedInt member |
| Core/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp | Adds m_rightMouseDownCameraPos / m_rightMouseUpCameraPos captured from TheTacticalView on each button event; all isClick call sites updated |
| Core/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp | Member renames (deselectFeedbackAnchor→rightMouseDownAnchor, lastClick→rightMouseDownTimeMs, etc.); isClick now receives live cameraPos instead of pre-subtracted delta |
| Core/Libraries/Include/Lib/BaseType.h | Adds operator+/-/+=/−=, add/sub, set, and lengthSqr to Coord2D, ICoord2D, Coord3D, ICoord3D; set() overloads correctly use matching scalar types |
| Core/GameEngine/Include/GameClient/CommandXlat.h | Member variable renames and addition of Coord3D camera-position anchors for right mouse down/up events |
| Core/GameEngine/Include/GameClient/SelectionXlat.h | Member renames aligned with CommandXlat naming convention; Coord3D camera position field added; m_deselectDownCameraPosition removed in favour of new name |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Mouse Button Down Event] --> B[Record mouseDownAnchor, timeMs, cameraPos]
A2[Mouse Button Up Event] --> C[Record mouseUpAnchor, timeMs, cameraPos]
C --> D[isClick mouse, camera, time]
D --> E{timeMsDelta > m_dragToleranceMS?}
E -- YES --> F[return FALSE - is a drag]
E -- NO --> G{mouseAnchorDelta.lengthSqr > sqr m_dragTolerance?}
G -- YES --> F
G -- NO --> H{cameraPosDelta.lengthSqr > sqr m_dragTolerance3D?}
H -- YES --> F
H -- NO --> I[return TRUE - is a click]
I --> J[CommandXlat: Cancel build placement / Alternate-mouse move-to-ground]
I --> K[SelectionXlat: Deselect / right-click action]
%%{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 Button Down Event] --> B[Record mouseDownAnchor, timeMs, cameraPos]
A2[Mouse Button Up Event] --> C[Record mouseUpAnchor, timeMs, cameraPos]
C --> D[isClick mouse, camera, time]
D --> E{timeMsDelta > m_dragToleranceMS?}
E -- YES --> F[return FALSE - is a drag]
E -- NO --> G{mouseAnchorDelta.lengthSqr > sqr m_dragTolerance?}
G -- YES --> F
G -- NO --> H{cameraPosDelta.lengthSqr > sqr m_dragTolerance3D?}
H -- YES --> F
H -- NO --> I[return TRUE - is a click]
I --> J[CommandXlat: Cancel build placement / Alternate-mouse move-to-ground]
I --> K[SelectionXlat: Deselect / right-click action]
Reviews (4): Last reviewed commit: "bugfix(mouse): Fix bad drag tolerances w..." | Re-trigger Greptile
920fa79 to
a412fc5
Compare
|
Would be nice if GO could do some A/B testing. |
8399669 to
cc8df7b
Compare
|
LoGicA
|
|
SR_MaD^
|
…oord3D, ICoord2D, ICoord3D (#2826)
cc8df7b to
44c5f0b
Compare
|
Rebased. I had to reapply all edits in SelectionXlat because of the mass refactor from a previous commit. |
…oord3D, ICoord2D, ICoord3D (#2826)
|
This change appears to introduce a regression - the player can no longer right-click to issue move orders while simultaneously moving the camera with the arrow keys. |
|
Ok |
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.
This is an alternative implementation to #2823 using the 3D camera tolerance.
TODO