X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fpainter.cpp;h=bdac361f59b64d7f68b2aca874ac169c0d92837d;hb=db0a3d91f37031e155cc8eac7cfdec9889f233ee;hp=046dd2a7d92fa0c608c1370a57c4d3d1a4700392;hpb=57056be35f9295400dd873a17d8468b3287ebc0c;p=architektonas diff --git a/src/painter.cpp b/src/painter.cpp index 046dd2a..bdac361 100644 --- a/src/painter.cpp +++ b/src/painter.cpp @@ -15,7 +15,8 @@ #include "painter.h" #include "mathconstants.h" -#include "object.h" +//#include "object.h" +#include "global.h" // Set class variable defaults @@ -203,6 +204,27 @@ void Painter::DrawArrowHandle(Vector center, double angle) } +// This function is for drawing object handles without regard for zoom level; +// we don't want our object handle size to depend on the zoom level! +void Painter::DrawArrowToLineHandle(Vector center, double angle) +{ + DrawArrowHandle(center, angle); + center = CartesianToQtCoords(center); + + // Since we're drawing directly on the screen, the Y is inverted. So we use + // the mirror of the angle. + double orthoAngle = -angle + (PI / 2.0); + Vector orthogonal = Vector(cos(orthoAngle), sin(orthoAngle)); + Vector unit = Vector(cos(-angle), sin(-angle)); + + Point p1 = center + (unit * 21.0); + Point p2 = p1 + (orthogonal * 7.0); + Point p3 = p1 - (orthogonal * 7.0); + + painter->drawLine(p2.x, p2.y, p3.x, p3.y); +} + + void Painter::DrawLine(int x1, int y1, int x2, int y2) { if (!painter) @@ -322,7 +344,7 @@ void Painter::DrawCrosshair(Vector point) void Painter::DrawInformativeText(QString text) { - painter->setFont(*Object::font); + painter->setFont(*Global::font); QRectF bounds = painter->boundingRect(QRectF(), Qt::AlignVCenter, text); bounds.moveTo(17.0, 17.0); QRectF textRect = bounds;