if (snapToGrid)
point = SnapPointToGrid(point);
+ if (snapPointIsValid)
+ point = snapPoint;
+
draggingCenter = hitCenter;
draggingEdge = hitCircle;
}
-/*virtual*/ void Circle::PointerMoved(Vector point)
+/*virtual*/ bool Circle::PointerMoved(Vector point)
{
if (selectionInProgress)
{
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();
+
+ if (snapToGrid)
+ point = SnapPointToGrid(point);
+
+ if (snapPointIsValid)
+ point = snapPoint;
+
objectWasDragged = (draggingEdge | draggingCenter);
if (objectWasDragged)
// Save this point so the rendering code knows where to draw the handle...
dragPoint = point;
+ return hovered;
}
pointed at length with our on screen length.
*/
if ((length * Painter::zoom) < 8.0)
+ {
hitCenter = true;
+ snapPoint = position;
+ snapPointIsValid = true;
+ }
//wrong: else if ((length < (radius + 2.0)) && (length > (radius - 2.0)))
/*NB: The following should be identical to what we have down below, but it doesn't work out that way... :-P */
//close, but no else if (((length * Painter::zoom) < ((radius * Painter::zoom) + 2.0)) && ((length * Painter::zoom) > ((radius * Painter::zoom) - 2.0)))
}
+/*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);
-// return new Circle(c1, radius);
position = c1;
}