+ // Check for whether or not the rect contains this circle
+// if (selection.normalized().contains(Extents()))
+ if (selection.contains(Extents()))
+ state = OSSelected;
+ else
+ state = OSInactive;
+
+ return false;
+ }
+
+/*
+Note that we can separate this out in the TLC, and it would probably make more sense
+to do it there as then we can be assured that all hit testing is done before we do
+any snapping. !!! FIX !!!
+*/
+ // Hit test tells us what we hit (if anything) through boolean variables. It
+ // also tells us whether or not the state changed.
+ SaveHitState();
+ bool hovered = HitTest(point);
+ needUpdate = HitStateChanged();
+
+ if (snapToGrid)
+ point = SnapPointToGrid(point);
+
+ if (snapPointIsValid)
+ point = snapPoint;
+
+ objectWasDragged = (draggingEdge | draggingCenter);
+
+ if (objectWasDragged)
+ needUpdate = true;
+
+ if (draggingEdge)
+ radius = Vector::Magnitude(point, position);
+ else if (draggingCenter)
+ position = point;
+
+ // Save this point so the rendering code knows where to draw the handle...
+ dragPoint = point;
+ return hovered;
+}
+
+
+/*virtual*/ void Circle::PointerReleased(void)
+{
+ // Mouse went up, so our dragging is done (if any *was* done, that is)
+ draggingEdge = draggingCenter = false;
+ hitCenter = hitCircle = false;
+
+ // If the object was dragged, then revert to the old state.
+ // Otherwise, we were probably just clicked, and want to stay in the selected state.
+ if (objectWasDragged)
+ state = oldState;
+}
+
+
+/*virtual*/ bool Circle::HitTest(Point point)
+{
+// SaveHitState();
+ hitCenter = hitCircle = false;
+ double length = Vector::Magnitude(position, point);
+//printf("Circle::length = %lf, radius = %lf\n", length, radius);
+//How to translate this into pixels from Document space???
+//Maybe we need to pass a scaling factor in here from the caller? That would make
+//sense, as the caller knows about the zoom factor and all that good kinda crap