]> Shamusworld >> Repos - architektonas/blobdiff - src/painter.cpp
Fix DrawArcAction to actually allow creation of Arcs.
[architektonas] / src / painter.cpp
index 308cab6b7bd87ed587cb884ae52113f1173abaad..a649306c74ecd96be81cbba047c8cba253be5d99 100644 (file)
@@ -208,7 +208,7 @@ void Painter::DrawPoint(int x, int y)
 }
 
 
-// This is drawn in Qt coordinates...
+// The rect passed in is in Qt coordinates...
 void Painter::DrawRoundedRect(QRectF rect, double radiusX, double radiusY)
 {
        if (!painter)
@@ -218,9 +218,8 @@ void Painter::DrawRoundedRect(QRectF rect, double radiusX, double radiusY)
 }
 
 
-// This is drawn partially in Cartesian coordinates, and partially in Qt
-// coordinates. The rect itself is in Cartesian but we want to pad it by a set
-// number of pixels.
+// The rect passed in is in Cartesian but we want to pad it by a set number of
+// pixels (currently set at 8), so the pad looks the same regardless of zoom.
 void Painter::DrawPaddedRect(QRectF rect)
 {
        if (!painter)
@@ -257,6 +256,9 @@ void Painter::DrawText(QRectF rect, int type, QString text)
 
 void Painter::DrawArrowhead(Vector head, Vector tail, double size)
 {
+       if (!painter)
+               return;
+
        QPolygonF arrow;
 
        // We draw the arrowhead aligned along the line from tail to head
@@ -278,3 +280,15 @@ void Painter::DrawArrowhead(Vector head, Vector tail, double size)
        painter->drawPolygon(arrow);
 }
 
+
+// Point is given in Cartesian coordinates
+void Painter::DrawCrosshair(Vector point)
+{
+       if (!painter)
+               return;
+
+       Vector screenPoint = CartesianToQtCoords(point);
+       painter->drawLine(0, screenPoint.y, screenSize.x, screenPoint.y);
+       painter->drawLine(screenPoint.x, 0, screenPoint.x, screenSize.y);
+}
+