diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2020-02-24 16:58:25 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2020-02-25 17:19:48 -0600 |
| commit | bd43e084f4e911d5eeec2f237559f382cd89f795 (patch) | |
| tree | 985d529507c22dac3d3c269112f07d8bf7c6aab4 /Source/Core/InputCommon/ControllerEmu | |
| parent | f8cca9fe5dc93b051fbb63247edad99533f19bfc (diff) | |
InputCommon: Clamp calibration values within square shape.
Diffstat (limited to 'Source/Core/InputCommon/ControllerEmu')
| -rw-r--r-- | Source/Core/InputCommon/ControllerEmu/StickGate.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp index 3346b874a2..30c9acdcbd 100644 --- a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp +++ b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp @@ -183,7 +183,8 @@ void ReshapableInput::UpdateCalibrationData(CalibrationData& data, Common::DVec2 auto& calibration_sample = data[calibration_index]; // Update closest sample from provided x,y. - calibration_sample = std::max(calibration_sample, point.Length()); + calibration_sample = std::clamp(point.Length(), calibration_sample, + SquareStickGate(1).GetRadiusAtAngle(calibration_angle)); // Here we update all other samples in our calibration vector to maintain // a convex polygon containing our new calibration point. |
