r25060 by jghali - Simplify complex expression by using std::copysign

scribus-commit scribus-commit at lists.scribus.net
Thu Mar 24 21:56:02 UTC 2022


Author: jghali
Date: Thu Mar 24 21:56:02 2022
New Revision: 25060

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25060
Log:
Simplify complex expression by using std::copysign

Modified:
    trunk/Scribus/scribus/scribusview.cpp

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25060&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp	(original)
+++ trunk/Scribus/scribus/scribusview.cpp	Thu Mar 24 21:56:02 2022
@@ -49,6 +49,7 @@
 #include <QStyleOptionRubberBand>
 #include <QWidgetAction>
 
+#include <cmath>
 #include <cstdio>
 #include <cstdlib>
 #include <utility>
@@ -3166,8 +3167,8 @@
 	}
 	else
 	{
-		int signOfX = (angleDelta.x() == 0) ? 0 : ((angleDelta.x() < 0) ? -1 : 1);
-		int signOfY = (angleDelta.y() == 0) ? 0 : ((angleDelta.y() < 0) ? -1 : 1);
+		int signOfX = (angleDelta.x() == 0) ? 0 : std::copysign(1.0, angleDelta.x());
+		int signOfY = (angleDelta.y() == 0) ? 0 : std::copysign(1.0, angleDelta.y());
 		int dX = -Prefs->uiPrefs.wheelJump * signOfX;
 		int dY = -Prefs->uiPrefs.wheelJump * signOfY;
 #ifndef Q_OS_MACOS




More information about the scribus-commit mailing list