Commit 427379a2 authored by Craig Watson's avatar Craig Watson

Set minimum size for protractor

parent ae380e4e
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
const QRectF UBGraphicsProtractor::sDefaultRect = QRectF(-250, -250, 500, 500); const QRectF UBGraphicsProtractor::sDefaultRect = QRectF(-250, -250, 500, 500);
const qreal UBGraphicsProtractor::minRadius = 70;
UBGraphicsProtractor::UBGraphicsProtractor() UBGraphicsProtractor::UBGraphicsProtractor()
: QGraphicsEllipseItem(sDefaultRect) : QGraphicsEllipseItem(sDefaultRect)
...@@ -213,11 +214,13 @@ void UBGraphicsProtractor::mouseMoveEvent(QGraphicsSceneMouseEvent *event) ...@@ -213,11 +214,13 @@ void UBGraphicsProtractor::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
case Resize : case Resize :
prepareGeometryChange(); if (radius() * mScaleFactor * scaleFactor > minRadius) {
setTransform(QTransform::fromTranslate(rect().center().x(), rect().center().y()), true); prepareGeometryChange();
setTransform(QTransform::fromScale(scaleFactor, scaleFactor), true); setTransform(QTransform::fromTranslate(rect().center().x(), rect().center().y()), true);
setTransform(QTransform::fromTranslate(-rect().center().x(), -rect().center().y()), true); setTransform(QTransform::fromScale(scaleFactor, scaleFactor), true);
mScaleFactor *= scaleFactor; setTransform(QTransform::fromTranslate(-rect().center().x(), -rect().center().y()), true);
mScaleFactor *= scaleFactor;
}
break; break;
case MoveMarker : case MoveMarker :
......
...@@ -119,6 +119,7 @@ class UBGraphicsProtractor : public UBAbstractDrawRuler, public QGraphicsEllipse ...@@ -119,6 +119,7 @@ class UBGraphicsProtractor : public UBAbstractDrawRuler, public QGraphicsEllipse
QGraphicsSvgItem* mRotateSvgItem; QGraphicsSvgItem* mRotateSvgItem;
static const QRectF sDefaultRect; static const QRectF sDefaultRect;
static const qreal minRadius;
virtual void rotateAroundCenter(qreal angle); virtual void rotateAroundCenter(qreal angle);
virtual QPointF rotationCenter() const; virtual QPointF rotationCenter() const;
......
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