X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Farc.cpp;h=f5078694d9a27a425b93ab98aca044997cf4248d;hb=7f3a6b11585376eecd80979ec3da2346c5314d88;hp=d4d747b7df80d1a3a7dd7cb8c4e1010609e82b7a;hpb=c85958d34fac175452fe420ff24ea82f26d6f1f3;p=architektonas diff --git a/src/arc.cpp b/src/arc.cpp index d4d747b..f507869 100644 --- a/src/arc.cpp +++ b/src/arc.cpp @@ -168,6 +168,9 @@ Also: should put the snap logic into the Object base class (as a static method). if (snapToGrid) point = SnapPointToGrid(point); + if (snapPointIsValid) + point = snapPoint; + /* State Management: We want the arc to go into OSSelected mode if we click on it but don't drag. @@ -241,6 +244,13 @@ so let's do like this: SaveHitState(); bool hovered = HitTest(point); needUpdate = HitStateChanged(); + + if (snapToGrid) + point = SnapPointToGrid(point); + + if (snapPointIsValid) + point = snapPoint; + objectWasDragged = (draggingCenter | draggingEdge | draggingRotate | draggingSpan); if (objectWasDragged) @@ -324,14 +334,26 @@ point (to get the correct position). hitArc = true; #else if ((length * Painter::zoom) < 8.0) + { hitCenter = true; + snapPoint = position; + snapPointIsValid = true; + } else if (((fabs(length - radius) * Painter::zoom) < 2.0) && AngleInArcSpan(pointerAngle)) hitArc = true; else if ((Vector::Magnitude(handle2, point) * Painter::zoom) < 8.0) + { hitRotate = true; + snapPoint = handle2; + snapPointIsValid = true; + } else if ((Vector::Magnitude(handle3, point) * Painter::zoom) < 8.0) + { hitSpan = true; + snapPoint = handle3; + snapPointIsValid = true; + } #endif return (hitCenter || hitArc || hitRotate || hitSpan ? true : false);