diff options
author | Antti Hölttä <AHoelttae@luxoft.com> | 2019-03-13 13:52:16 +0100 |
---|---|---|
committer | Antti Hölttä <AHoelttae@luxoft.com> | 2019-03-18 16:43:30 +0100 |
commit | d62c290ee9e196b295f2dca172313c050b26dea4 (patch) | |
tree | b0a2b75fa862755297ea6ec4fe8e31675c2b90f5 /plugin | |
parent | b0de855379a9242d74353dfd66677d4b1b5dbcec (diff) |
Fix issue with move-method when using angles greater or equal to 360
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/inputtypes.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/plugin/inputtypes.cpp b/plugin/inputtypes.cpp index c114ec8..60cd104 100644 --- a/plugin/inputtypes.cpp +++ b/plugin/inputtypes.cpp @@ -29,9 +29,12 @@ bool CursorNavigationCommand::angleIsBetween(qreal angle, qreal begin, qreal end qreal CursorNavigationCommand::fitAngle(qreal angle) { + if (angle >= 2.0*M_PI) + angle = std::fmod(angle, 2.0*M_PI); + if (angle > M_PI) - return -M_PI + std::fmod(angle ,M_PI); + return -M_PI + std::fmod(angle, M_PI); else if (angle < -M_PI) - return M_PI + std::fmod(angle ,M_PI); + return M_PI + std::fmod(angle, M_PI); return angle; } |