]> Shamusworld >> Repos - architektonas/blobdiff - src/arc.cpp
Mirror tool now works successfully for all object types. :-D
[architektonas] / src / arc.cpp
index b0e3b720148bd502f6cc1eb425972d6e111a8cfc..f7cde5283c8befbf01926979e787d9afa1aa8c6b 100644 (file)
@@ -16,6 +16,7 @@
 #include "arc.h"
 
 #include <QtGui>
+#include "geometry.h"
 #include "mathconstants.h"
 #include "painter.h"
 
@@ -151,6 +152,10 @@ Also: should put the snap logic into the Object base class (as a static method).
 
 /*virtual*/ bool Arc::Collided(Vector point)
 {
+       // Someone told us to fuck off, so we'll fuck off. :-)
+       if (ignoreClicks)
+               return false;
+
        objectWasDragged = false;
        bool hitSomething = HitTest(point);
        draggingCenter = hitCenter;
@@ -450,3 +455,33 @@ same reference number.
        return new Arc(position, radius, startAngle, angleSpan, parent);
 }
 
+
+/*virtual*/ void Arc::Mirror(Point p1, Point p2)
+{
+       Point c1 = Geometry::MirrorPointAroundLine(position, p1, p2);
+       Point ap1(cos(startAngle + angleSpan), sin(startAngle + angleSpan));
+       Point angleEndPoint = (ap1 * radius) + position;
+       Point c2 = Geometry::MirrorPointAroundLine(angleEndPoint, p1, p2);
+
+       position = c1;
+       startAngle = Vector(c2, c1).Angle();
+}
+
+
+/*virtual*/ void Arc::Save(void)
+{
+       Object::Save();
+       oldRadius2 = radius;
+       oldStartAngle = startAngle;
+       oldAngleSpan = angleSpan;
+}
+
+
+/*virtual*/ void Arc::Restore(void)
+{
+       Object::Restore();
+       radius = oldRadius2;
+       startAngle = oldStartAngle;
+       angleSpan = oldAngleSpan;
+}
+