summaryrefslogtreecommitdiffstats
path: root/src/input_common/drivers
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2023-07-06 01:42:16 +0200
committerNarr the Reg <juangerman-13@hotmail.com>2023-07-06 01:42:16 +0200
commit4c84bce171915f0f95b6269ed21f58667831ccdf (patch)
tree94d567347c175591df5f0e503655e014aaf71e7e /src/input_common/drivers
parentMerge pull request #10994 from liamwhite/ue4-preferred (diff)
downloadyuzu-4c84bce171915f0f95b6269ed21f58667831ccdf.tar
yuzu-4c84bce171915f0f95b6269ed21f58667831ccdf.tar.gz
yuzu-4c84bce171915f0f95b6269ed21f58667831ccdf.tar.bz2
yuzu-4c84bce171915f0f95b6269ed21f58667831ccdf.tar.lz
yuzu-4c84bce171915f0f95b6269ed21f58667831ccdf.tar.xz
yuzu-4c84bce171915f0f95b6269ed21f58667831ccdf.tar.zst
yuzu-4c84bce171915f0f95b6269ed21f58667831ccdf.zip
Diffstat (limited to 'src/input_common/drivers')
-rw-r--r--src/input_common/drivers/mouse.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp
index dac29c78f..9fb824baf 100644
--- a/src/input_common/drivers/mouse.cpp
+++ b/src/input_common/drivers/mouse.cpp
@@ -160,8 +160,9 @@ void Mouse::Move(int x, int y, int center_x, int center_y) {
last_mouse_change.y += mouse_change.y * y_sensitivity;
// Bind the mouse change to [0 <= deadzone_counterweight <= 1.0]
- if (last_mouse_change.Length() < deadzone_counterweight) {
- last_mouse_change /= last_mouse_change.Length();
+ const float length = last_mouse_change.Length();
+ if (length < deadzone_counterweight && length != 0.0f) {
+ last_mouse_change /= length;
last_mouse_change *= deadzone_counterweight;
}