+ // 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
+/*
+Document passes in the correct Cartesian coordinates being pointed to by the mouse.
+So all we have to be concerned with is properly scaling our hot zones/handle sizes,
+since we generally *don't* want those to scale with the zoom level. ;-)
+
+What is going on here?
+If we're zoomed out to, say, 50%, & our radius is 10.0 (absolute), then on screen
+the radius will be 5.0. By multiplying the length by the zoom factor, we align our
+pointed at length with our on screen length.
+*/
+ if ((length * Painter::zoom) < 8.0)
+ {
+ hitCenter = true;
+
+ // Make sure we don't try to snap to ourselves...!
+ if (!draggingCenter)