diff --git a/hivewidget.cpp b/hivewidget.cpp index 8c42c1d..6a0dc4f 100644 --- a/hivewidget.cpp +++ b/hivewidget.cpp @@ -6,7 +6,8 @@ #include HiveWidget::HiveWidget(QWidget *parent) - : QOpenGLWidget(parent) + : QOpenGLWidget(parent), + m_scaleEdgeMax(true) { setMouseTracking(true); } @@ -182,8 +183,13 @@ void HiveWidget::calculate() double otherMagnitude = hypot(otherX - cx, otherY - cy); double averageRadians = atan2(((nodeY - cy) + (otherY - cy))/2, ((nodeX - cx) + (otherX - cx))/2); -// double averageMagnitude = (magnitude + otherMagnitude) / 2; - double averageMagnitude = qMax(magnitude, otherMagnitude); + double averageMagnitude; + if (m_scaleEdgeMax) { + averageMagnitude = qMax(magnitude, otherMagnitude); + } else { + averageMagnitude = (magnitude + otherMagnitude) / 2; + } + QPointF controlPoint(cos(averageRadians) * averageMagnitude + cx, sin(averageRadians) * averageMagnitude + cy); QLinearGradient gradient(m_positions[node], m_positions[otherNode]); diff --git a/hivewidget.h b/hivewidget.h index 2997260..dc2d9e5 100644 --- a/hivewidget.h +++ b/hivewidget.h @@ -38,6 +38,7 @@ class HiveWidget : public QOpenGLWidget QMap m_colors; QMap m_positions; QString m_closest; + bool m_scaleEdgeMax; }; #endif // HIVEWIDGET_H