Commit 6db2bfd2 authored by Aleks Kissinger's avatar Aleks Kissinger

keep inAngle and outAngle snapped to 15-degree increments

parent 0002340d
......@@ -169,8 +169,10 @@ void Edge::updateControls() {
qreal bnd = static_cast<qreal>(_bend) * (M_PI / 180.0);
outAngleR = angle - bnd;
inAngleR = M_PI + angle + bnd;
_outAngle = static_cast<int>(round(outAngleR * (180.0 / M_PI)));
_inAngle = static_cast<int>(round(inAngleR * (180.0 / M_PI)));
// keep _inAngle and _outAngle snapped to increments of 15 degrees
_outAngle = static_cast<int>(roundToNearest(15.0, outAngleR * (180.0 / M_PI)));
_inAngle = static_cast<int>(roundToNearest(15.0, inAngleR * (180.0 / M_PI)));
} else {
outAngleR = static_cast<qreal>(_outAngle) * (M_PI / 180.0);
inAngleR = static_cast<qreal>(_inAngle) * (M_PI / 180.0);
......
......@@ -72,7 +72,7 @@ void NodeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidge
QVector<qreal> p;
p << 1.0 << 2.0;
pen.setDashPattern(p);
pen.setWidthF(2.0f);
pen.setWidthF(2.0);
painter->setPen(pen);
painter->setBrush(Qt::NoBrush);
painter->drawPath(shape());
......@@ -135,10 +135,10 @@ void NodeItem::updateBounds()
prepareGeometryChange();
QString label = _node->label();
if (label != "") {
QFontMetrics fm(Tikzit::LABEL_FONT);
QRectF labelRect = fm.boundingRect(label);
labelRect.moveCenter(QPointF(0, 0));
_boundingRect = labelRect.united(shape().boundingRect()).adjusted(-4, -4, 4, 4);
//QFontMetrics fm(Tikzit::LABEL_FONT);
//QRectF labelRect = fm.boundingRect(label);
//labelRect.moveCenter(QPointF(0, 0));
_boundingRect = labelRect().united(shape().boundingRect()).adjusted(-4, -4, 4, 4);
} else {
_boundingRect = shape().boundingRect().adjusted(-4, -4, 4, 4);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment