Vector current(point2 - point1);
Vector v = current.Unit() * length;
Vector v2 = point1 + v;
-// painter->DrawLine((int)point1.x, (int)point1.y, (int)v2.x, (int)v2.y);
painter->DrawLine(point1, v2);
if (current.Magnitude() > length)
{
painter->SetPen(QPen(QColor(128, 0, 0), 1.0, Qt::DashLine));
-// painter->DrawLine((int)v2.x, (int)v2.y, (int)point2.x, (int)point2.y);
painter->DrawLine(v2, point2);
}
}
-// Problem: when drawing at large zoom levels, this throws away precision thus
-// causing the line to rendered too short. !!! FIX !!! [DONE]
else
-// painter->DrawLine((int)position.x, (int)position.y, (int)endpoint.x, (int)endpoint.y);
painter->DrawLine(position, endpoint);
- // If we're rotating or setting the span, draw an information panel
- // showing both absolute and relative angles being set.
+ // If we're dragging an endpoint, draw an information panel showing both
+ // the length and angle being set.
if (draggingHandle1 || draggingHandle2)
{
double absAngle = (Vector(endpoint - position).Angle()) * RADIANS_TO_DEGREES;
-// double relAngle = (startAngle >= oldAngle ? startAngle - oldAngle :
-// startAngle - oldAngle + (2.0 * PI)) * RADIANS_TO_DEGREES;
double absLength = Vector(position - endpoint).Magnitude();
QString text;
QPen pen = QPen(QColor(0x00, 0xFF, 0x00), 1.0, Qt::SolidLine);
painter->SetPen(pen);
painter->SetBrush(QBrush(QColor(0x40, 0xFF, 0x40, 0x9F)));
- QRectF textRect(10.0, 10.0, 270.0, 70.0); // x, y, w, h
+ QRectF textRect(10.0, 10.0, 270.0, 70.0); // x, y, w, h (in Qt coords)
painter->DrawRoundedRect(textRect, 7.0, 7.0);
textRect.setLeft(textRect.left() + 14);
painter->SetFont(*Object::font);
-// pen = QPen(QColor(0xDF, 0x5F, 0x00), 1.0, Qt::SolidLine);
pen = QPen(QColor(0x00, 0x5F, 0xDF));
painter->SetPen(pen);
painter->DrawText(textRect, Qt::AlignVCenter, text);
-// painter->SetPen(QPen(QColor(0xDF, 0x5F, 0x00)));
}
}
{
// We can assume this, since this is a mouse down event here.
objectWasDragged = false;
- SaveState();
+// SaveHitState();
HitTest(point);
-// return StateChanged();
+// return HitStateChanged();
// this is shite. this should be checked for in the Container, not here!
// If we're part of a non-top-level container, send this signal to it
// Hit test tells us what we hit (if anything) through boolean variables. (It
// also tells us whether or not the state changed. --not any more)
- SaveState();
+ SaveHitState();
HitTest(point);
- needUpdate = StateChanged();
+ needUpdate = HitStateChanged();
objectWasDragged = (draggingLine | draggingHandle1 | draggingHandle2);
/*virtual*/ bool Line::HitTest(Point point)
{
-// SaveState();
+// SaveHitState();
hitPoint1 = hitPoint2 = hitLine = false;
Vector lineSegment = endpoint - position;
else if ((distance * Painter::zoom) < 5.0)
hitLine = true;
- return (hitPoint1 | hitPoint2 | hitLine ? true : false);
-// return StateChanged();
+ return (hitPoint1 || hitPoint2 || hitLine ? true : false);
+// return HitStateChanged();
}
}
-void Line::SaveState(void)
+void Line::SaveHitState(void)
{
oldHitPoint1 = hitPoint1;
oldHitPoint2 = hitPoint2;
}
-bool Line::StateChanged(void)
+bool Line::HitStateChanged(void)
{
if ((hitPoint1 != oldHitPoint1) || (hitPoint2 != oldHitPoint2) || (hitLine != oldHitLine))
return true;