]> Shamusworld >> Repos - architektonas/blobdiff - src/circle.cpp
Added new triangulation tool, ability to snap to endpoints/intersections.
[architektonas] / src / circle.cpp
index 94a9ec8f807b47b5e867bb3e5fab79b951c46c3a..093f53395834bd3472a05a3242ad148bd1cc8759 100644 (file)
@@ -100,6 +100,9 @@ Circle::~Circle()
        if (snapToGrid)
                point = SnapPointToGrid(point);
 
+       if (snapPointIsValid)
+               point = snapPoint;
+
        draggingCenter = hitCenter;
        draggingEdge = hitCircle;
 
@@ -137,6 +140,13 @@ Circle::~Circle()
        SaveHitState();
        bool hovered = HitTest(point);
        needUpdate = HitStateChanged();
+
+       if (snapToGrid)
+               point = SnapPointToGrid(point);
+
+       if (snapPointIsValid)
+               point = snapPoint;
+
        objectWasDragged = (draggingEdge | draggingCenter);
 
        if (objectWasDragged)
@@ -186,7 +196,11 @@ the radius will be 5.0. By multiplying the length by the zoom factor, we align o
 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)))