From bc9e3fec14b0b17fb082f271f58f76c549704b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikko=20Syrj=C3=A4?= Date: Wed, 27 Feb 2019 23:51:50 +0200 Subject: Fixes for toobar buttons and tooltips. --- symbol.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'symbol.cpp') diff --git a/symbol.cpp b/symbol.cpp index 93891ea..b06027a 100644 --- a/symbol.cpp +++ b/symbol.cpp @@ -4,6 +4,11 @@ #include "symbol.h" +const double ConstPi = 3.14159265358979323846; //!< Constant for PI. +const double Const2Pi = 2.0 * ConstPi; //!< Constant for PI * 2. +const double ConstPi2 = ConstPi / 2.0; //!< Constant for PI / 2. +const double ConstPi4 = ConstPi / 4.0; //!< Constant for PI / 4. + // // symbol item functions // @@ -292,7 +297,7 @@ void SymEditSymbol::RotateSymbol(int dir) { double length = sqrt(point.x() * point.x() + point.y() * point.y()); double angle = atan2(point.y(), point.x()); - angle += (dir > 0 ? -M_PI / 2.0 : M_PI / 2.0); + angle += (dir > 0 ? -ConstPi2 : ConstPi2); double x = cos(angle) * length, y = sin(angle) * length; point.setX(static_cast(x + (x > 0.0 ? 0.5 : -0.5))); point.setY(static_cast(y + (y > 0.0 ? 0.5 : -0.5))); -- cgit v1.2.3