X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fcircle.cpp;h=94a9ec8f807b47b5e867bb3e5fab79b951c46c3a;hb=57056be35f9295400dd873a17d8468b3287ebc0c;hp=75e9d9352e2749ccea3defaca75452bddb8d5aa9;hpb=143b369c0308a8cd524cb0ed51c5d67d6be69603;p=architektonas diff --git a/src/circle.cpp b/src/circle.cpp index 75e9d93..94a9ec8 100644 --- a/src/circle.cpp +++ b/src/circle.cpp @@ -16,6 +16,7 @@ #include "circle.h" #include +#include "geometry.h" #include "painter.h" @@ -86,6 +87,10 @@ Circle::~Circle() /*virtual*/ bool Circle::Collided(Vector point) { + // Someone told us to fuck off, so we'll fuck off. :-) + if (ignoreClicks) + return false; + // We can assume this, since this is a mouse down event here. objectWasDragged = false; HitTest(point); @@ -113,7 +118,7 @@ Circle::~Circle() } -/*virtual*/ void Circle::PointerMoved(Vector point) +/*virtual*/ bool Circle::PointerMoved(Vector point) { if (selectionInProgress) { @@ -124,13 +129,13 @@ Circle::~Circle() else state = OSInactive; - return; + return false; } // Hit test tells us what we hit (if anything) through boolean variables. It // also tells us whether or not the state changed. SaveHitState(); - HitTest(point); + bool hovered = HitTest(point); needUpdate = HitStateChanged(); objectWasDragged = (draggingEdge | draggingCenter); @@ -144,6 +149,7 @@ Circle::~Circle() // Save this point so the rendering code knows where to draw the handle... dragPoint = point; + return hovered; } @@ -218,7 +224,7 @@ bool Circle::HitStateChanged(void) /*virtual*/ void Circle::Enumerate(FILE * file) { - fprintf(file, "CIRCLE (%lf,%lf) %lf\n", position.x, position.y, radius); + fprintf(file, "CIRCLE %i (%lf,%lf) %lf\n", layer, position.x, position.y, radius); } @@ -237,3 +243,31 @@ same reference number. return new Circle(position, radius, parent); } + +/*virtual*/ void Circle::Rotate(Point point, double angle) +{ + Point c1 = Geometry::RotatePointAroundPoint(position, point, angle); + position = c1; +} + + +/*virtual*/ void Circle::Mirror(Point p1, Point p2) +{ + Point c1 = Geometry::MirrorPointAroundLine(position, p1, p2); + position = c1; +} + + +/*virtual*/ void Circle::Save(void) +{ + Object::Save(); + oldRadius2 = radius; +} + + +/*virtual*/ void Circle::Restore(void) +{ + Object::Restore(); + radius = oldRadius2; +} +