@ -37,10 +37,8 @@
# include <QtWidgets/QGraphicsView>
# include <QtWidgets/QGraphicsView>
//#include <math.h>
const QRectF UBGraphicsProtractor : : sDefaultRect = QRectF ( - 250 , - 250 , 500 , 500 ) ;
const QRectF UBGraphicsProtractor : : sDefaultRect = QRectF ( - 175 , - 175 , 350 , 350 ) ;
UBGraphicsProtractor : : UBGraphicsProtractor ( )
UBGraphicsProtractor : : UBGraphicsProtractor ( )
: QGraphicsEllipseItem ( sDefaultRect )
: QGraphicsEllipseItem ( sDefaultRect )
@ -82,9 +80,11 @@ UBGraphicsProtractor::UBGraphicsProtractor()
setData ( UBGraphicsItemData : : itemLayerType , QVariant ( itemLayerType : : CppTool ) ) ; //Necessary to set if we want z value to be assigned correctly
setData ( UBGraphicsItemData : : itemLayerType , QVariant ( itemLayerType : : CppTool ) ) ; //Necessary to set if we want z value to be assigned correctly
setFlag ( QGraphicsItem : : ItemIsSelectable , false ) ;
setFlag ( QGraphicsItem : : ItemIsSelectable , false ) ;
setScale ( 1.5 ) ;
mCloseSvgItem - > setPos ( closeButtonRect ( ) . topLeft ( ) ) ;
mResetSvgItem - > setPos ( resetButtonRect ( ) . topLeft ( ) ) ;
mResizeSvgItem - > setPos ( resizeButtonRect ( ) . topLeft ( ) ) ;
mMarkerSvgItem - > setPos ( markerButtonRect ( ) . topLeft ( ) ) ;
mRotateSvgItem - > setPos ( rotateButtonRect ( ) . topLeft ( ) ) ;
}
}
@ -95,8 +95,11 @@ void UBGraphicsProtractor::paint(QPainter *painter, const QStyleOptionGraphicsIt
Q_UNUSED ( styleOption ) ;
Q_UNUSED ( styleOption ) ;
Q_UNUSED ( widget ) ;
Q_UNUSED ( widget ) ;
QPen pen_ ( drawColor ( ) ) ;
pen_ . setWidth ( 0 ) ; // Line width = 1 pixel regardless of scale / zoom
painter - > setPen ( pen_ ) ;
painter - > setFont ( QFont ( " Arial " ) ) ;
painter - > setFont ( QFont ( " Arial " ) ) ;
painter - > setPen ( drawColor ( ) ) ;
painter - > setBrush ( fillBrush ( ) ) ;
painter - > setBrush ( fillBrush ( ) ) ;
painter - > drawPie ( QRectF ( rect ( ) . center ( ) . x ( ) - radius ( ) , rect ( ) . center ( ) . y ( ) - radius ( ) , 2 * radius ( ) , 2 * radius ( ) ) , mStartAngle * 16 , mSpan * 16 ) ;
painter - > drawPie ( QRectF ( rect ( ) . center ( ) . x ( ) - radius ( ) , rect ( ) . center ( ) . y ( ) - radius ( ) , 2 * radius ( ) , 2 * radius ( ) ) , mStartAngle * 16 , mSpan * 16 ) ;
paintGraduations ( painter ) ;
paintGraduations ( painter ) ;
@ -195,12 +198,6 @@ void UBGraphicsProtractor::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
qreal angle = startLine . angleTo ( currentLine ) ;
qreal angle = startLine . angleTo ( currentLine ) ;
qreal scaleFactor = currentLine . length ( ) / startLine . length ( ) ;
qreal scaleFactor = currentLine . length ( ) / startLine . length ( ) ;
qreal mod_angle = 0 ;
if ( angle > 350 )
{
mod_angle = angle - 360 ; // only for debugging
angle = angle - 360 ;
}
switch ( mCurrentTool )
switch ( mCurrentTool )
{
{
@ -210,17 +207,15 @@ void UBGraphicsProtractor::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
setStartAngle ( mStartAngle * 16 ) ;
setStartAngle ( mStartAngle * 16 ) ;
mPreviousMousePos = currentPoint ;
mPreviousMousePos = currentPoint ;
//qDebug() << "UBGraphicsProtractor Rotate"<<"mStartAngle= "<<mStartAngle<<"angle = "<<angle<<"modulo_angle"<<mod_angle;
break ;
break ;
case Resize :
case Resize :
prepareGeometryChange ( ) ;
prepareGeometryChange ( ) ;
setPos ( rect ( ) . center ( ) . x ( ) , rect ( ) . center ( ) . y ( ) ) ;
setTransform ( QTransform : : fromTranslate ( rect ( ) . center ( ) . x ( ) , rect ( ) . center ( ) . y ( ) ) , true ) ;
setTransform ( QTransform : : fromScale ( scaleFactor , scaleFactor ) , true ) ;
setScale ( scaleFactor ) ;
setTransform ( QTransform : : fromTranslate ( - rect ( ) . center ( ) . x ( ) , - rect ( ) . center ( ) . y ( ) ) , true ) ;
setPos ( - rect ( ) . center ( ) . x ( ) , - rect ( ) . center ( ) . y ( ) ) ;
mScaleFactor * = scaleFactor ;
mScaleFactor * = scaleFactor ;
break ;
break ;
case MoveMarker :
case MoveMarker :
@ -346,70 +341,70 @@ qreal UBGraphicsProtractor::antiScale() const
QRectF UBGraphicsProtractor : : resetButtonRect ( ) const
QRectF UBGraphicsProtractor : : resetButtonRect ( ) const
{
{
//qreal antiSc = antiScale();
qreal refWidth = buttonSizeReference ( ) . width ( ) ;
qreal antiSc = 1 ;
qreal width = mResetSvgItem - > boundingRect ( ) . width ( ) ;
qreal height = mResetSvgItem - > boundingRect ( ) . height ( ) ;
return QRectF ( - refWidth * 7 , - height / 2.0 , width , height ) ;
if ( buttonSizeReference ( ) . width ( ) * antiSc < = buttonSizeReference ( ) . width ( ) * 15 )
// Note: these hardcoded position values make it impossible
return QRectF ( - buttonSizeReference ( ) . width ( ) * 7 , - buttonSizeReference ( ) . height ( ) * antiSc / 2 ,
// to use setScale() on the buttons without affecting their
buttonSizeReference ( ) . width ( ) * antiSc , buttonSizeReference ( ) . height ( ) * antiSc ) ;
// relative position on the tool.
else
return QRectF ( - buttonSizeReference ( ) . width ( ) * antiSc / 2 , - buttonSizeReference ( ) . height ( ) * antiSc / 2 ,
buttonSizeReference ( ) . width ( ) * antiSc , buttonSizeReference ( ) . height ( ) * antiSc ) ;
}
}
QRectF UBGraphicsProtractor : : closeButtonRect ( ) const
QRectF UBGraphicsProtractor : : closeButtonRect ( ) const
{
{
//qreal antiSc = antiScale();
qreal refWidth = buttonSizeReference ( ) . width ( ) ;
qreal antiSc = 1 ;
qreal width = mCloseSvgItem - > boundingRect ( ) . width ( ) ;
qreal height = mCloseSvgItem - > boundingRect ( ) . height ( ) ;
return QRectF ( - refWidth * 9 , - height / 2.0 , width , height ) ;
//qDebug() << "UBGraphicsProtractor closeButtonRect"<<"antiSc = "<<antiSc;
}
if ( buttonSizeReference ( ) . width ( ) * antiSc < = buttonSizeReference ( ) . width ( ) * 2 )
QRectF UBGraphicsProtractor : : resizeButtonRect ( ) const
return QRectF ( - buttonSizeReference ( ) . width ( ) * 9 , - buttonSizeReference ( ) . height ( ) * antiSc / 2 ,
{
buttonSizeReference ( ) . width ( ) * antiSc , buttonSizeReference ( ) . height ( ) * antiSc ) ;
qreal refWidth = buttonSizeReference ( ) . width ( ) ;
else if ( buttonSizeReference ( ) . width ( ) * antiSc < = buttonSizeReference ( ) . width ( ) * 15 )
qreal width = mResizeSvgItem - > boundingRect ( ) . width ( ) ;
return QRectF ( - buttonSizeReference ( ) . width ( ) * 7 - buttonSizeReference ( ) . width ( ) * antiSc , - buttonSizeReference ( ) . height ( ) * antiSc / 2 ,
qreal height = mResizeSvgItem - > boundingRect ( ) . height ( ) ;
buttonSizeReference ( ) . width ( ) * antiSc , buttonSizeReference ( ) . height ( ) * antiSc ) ;
else
return QRectF ( - buttonSizeReference ( ) . width ( ) * antiSc / 2 , - buttonSizeReference ( ) . height ( ) * antiSc / 2 ,
buttonSizeReference ( ) . width ( ) * antiSc , buttonSizeReference ( ) . height ( ) * antiSc ) ;
return QRectF ( refWidth * 8 , - height / 2.0 , width , height ) ;
}
}
QRectF UBGraphicsProtractor : : resiz eButtonRect ( ) const
QRectF UBGraphicsProtractor : : rotat eButtonRect ( ) const
{
{
//qreal antiSc = antiScale();
qreal refWidth = buttonSizeReference ( ) . width ( ) ;
qreal antiSc = 1 ;
qreal width = mRotateSvgItem - > boundingRect ( ) . width ( ) ;
qreal height = mRotateSvgItem - > boundingRect ( ) . height ( ) ;
return QRectF ( refWidth * 5.5 , - refWidth * 5 , width , height ) ;
if ( buttonSizeReference ( ) . width ( ) * antiSc < = buttonSizeReference ( ) . width ( ) * 15 )
return QRectF ( buttonSizeReference ( ) . width ( ) * 8 , - buttonSizeReference ( ) . height ( ) * antiSc / 2 ,
buttonSizeReference ( ) . width ( ) * antiSc , buttonSizeReference ( ) . height ( ) * antiSc ) ;
else
{
mResizeSvgItem - > setZValue ( zValue ( ) + 10 ) ;
return QRectF ( - buttonSizeReference ( ) . width ( ) * antiSc / 2 , - buttonSizeReference ( ) . height ( ) * antiSc / 2 ,
buttonSizeReference ( ) . width ( ) * antiSc , buttonSizeReference ( ) . height ( ) * antiSc ) ;
}
}
}
QRectF UBGraphicsProtractor : : markerButtonRect ( ) const
{
qreal width = mMarkerSvgItem - > boundingRect ( ) . width ( ) ;
qreal height = mMarkerSvgItem - > boundingRect ( ) . height ( ) ;
return QRectF ( radius ( ) + 3 , - height / 2 , width , height ) ;
}
void UBGraphicsProtractor : : paintGraduations ( QPainter * painter )
void UBGraphicsProtractor : : paintGraduations ( QPainter * painter )
{
{
painter - > save ( ) ;
painter - > save ( ) ;
const int tenDegreeGraduationLength = 15 ;
const int tenDegreeGraduationLength = 22 ;
const int fiveDegreeGraduationLength = 10 ;
const int fiveDegreeGraduationLength = 15 ;
const int oneDegreeGraduationLength = 5 ;
const int oneDegreeGraduationLength = 7 ;
QFont font1 = painter - > font ( ) ;
QFont font1 = painter - > font ( ) ;
# ifdef Q_OS_OSX
# ifdef Q_OS_OSX
font1 . setPointSizeF ( font1 . pointSizeF ( ) - 3 ) ;
// TODO: remove this (?)
font1 . setPointSizeF ( font1 . pointSizeF ( ) ) ;
font1 . setWeight ( QFont : : Thin ) ;
# endif
# endif
QFontMetricsF fm1 ( font1 ) ;
QFontMetricsF fm1 ( font1 ) ;
@ -429,7 +424,8 @@ void UBGraphicsProtractor::paintGraduations(QPainter *painter)
qreal co = cos ( ( ( qreal ) angle + mStartAngle ) * PI / 180 ) ;
qreal co = cos ( ( ( qreal ) angle + mStartAngle ) * PI / 180 ) ;
qreal si = sin ( ( ( qreal ) angle + mStartAngle ) * PI / 180 ) ;
qreal si = sin ( ( ( qreal ) angle + mStartAngle ) * PI / 180 ) ;
if ( 0 = = angle % 90 )
if ( 0 = = angle % 90 )
painter - > drawLine ( QLineF ( QPointF ( center . x ( ) , center . y ( ) ) , QPointF ( center . x ( ) + co * tenDegreeGraduationLength , center . y ( ) - si * tenDegreeGraduationLength ) ) ) ;
painter - > drawLine ( QLineF ( QPointF ( center . x ( ) , center . y ( ) ) ,
QPointF ( center . x ( ) + co * tenDegreeGraduationLength , center . y ( ) - si * tenDegreeGraduationLength ) ) ) ;
//external arc
//external arc
painter - > drawLine ( QLineF ( QPointF ( center . x ( ) + rad * co , center . y ( ) - rad * si ) ,
painter - > drawLine ( QLineF ( QPointF ( center . x ( ) + rad * co , center . y ( ) - rad * si ) ,
@ -468,145 +464,34 @@ void UBGraphicsProtractor::paintButtons(QPainter *painter)
{
{
Q_UNUSED ( painter ) ;
Q_UNUSED ( painter ) ;
qreal co = cos ( mStartAngle * PI / 180 ) ; // cos(rad)
qreal si = sin ( mStartAngle * PI / 180 ) ; //sin(rad)
if ( mShowButtons )
if ( mShowButtons )
{
{
qreal scale = buttonSizeReference ( ) . width ( ) / mCloseSvgItem - > boundingRect ( ) . width ( ) ;
// The buttons (close, reset, resize & rotate) are rotated around the center
// of the protractor, to follow it as it is rotated.
/*qDebug() << "UBGraphicsProtractor paint()"
// As coordinates are local to each QGraphicsItem, the position of the rotation
< < " closeButtonRect_Topleft= " < < closeButtonRect ( ) . topLeft ( )
// center relative to each button is the inverse of that button's position.
< < " mStartAngle= " < < mStartAngle
< < " mCurrentAngle= " < < mCurrentAngle
< < " rect_center = " < < rect ( ) . center ( ) ;
*/
// Determine and apply the coordinates of the close button object.
mCloseSvgItem - > setTransformOriginPoint ( closeButtonRect ( ) . topLeft ( ) * - 1 ) ;
//---------------------------------------------------------------
qreal pos_close_x = closeButtonRect ( ) . topLeft ( ) . x ( ) * co ;
qreal pos_close_y = qAbs ( closeButtonRect ( ) . topLeft ( ) . x ( ) ) * si + closeButtonRect ( ) . topLeft ( ) . y ( ) ;
qDebug ( ) < < " pos_close_x = " < < pos_close_x < < " pos_close_y = " < < pos_close_y < < " cos " < < co < < " sin " < < si ;
mCloseSvgItem - > setPos ( pos_close_x , pos_close_y ) ;
mCloseSvgItem - > resetTransform ( ) ;
//mCloseSvgItem->translate(-closeButtonRect().left(),-closeButtonRect().top()); --
mCloseSvgItem - > setPos ( - pos_close_x , - pos_close_y ) ;
//mCloseSvgItem->setPos(-closeButtonRect().left(),-closeButtonRect().top());
//mCloseSvgItem->rotate(-mStartAngle); --
mCloseSvgItem - > setRotation ( rotation ( ) - mStartAngle ) ;
mCloseSvgItem - > setRotation ( rotation ( ) - mStartAngle ) ;
//mCloseSvgItem->translate(closeButtonRect().left(), closeButtonRect().top()); --
mCloseSvgItem - > setPos ( pos_close_x , pos_close_y ) ;
//mCloseSvgItem->setPos(closeButtonRect().left(), closeButtonRect().top());
//mCloseSvgItem->scale(scale * antiSc, scale * antiSc);//this do not impact the bounding box of thr svg item...
mCloseSvgItem - > setScale ( scale ) ; //this do not impact the bounding box of thr svg item...
// Determine and apply the position on the reset button object.
//------------------------------------------------------------
qreal pos_reset_x = resetButtonRect ( ) . topLeft ( ) . x ( ) * co ;
qreal pos_reset_y = qAbs ( resetButtonRect ( ) . topLeft ( ) . x ( ) ) * si + resetButtonRect ( ) . topLeft ( ) . y ( ) ;
mResetSvgItem - > setPos ( pos_reset_x , pos_reset_y ) ;
//mResetSvgItem->setPos(resetButtonRect().topLeft() + rect().center());
mResetSvgItem - > resetTransform ( ) ;
//mResetSvgItem->translate(-resetButtonRect().left(), -resetButtonRect().top());--
mResetSvgItem - > setPos ( - pos_reset_x , - pos_reset_y ) ;
//mResetSvgItem->rotate(-mStartAngle);--
mResetSvgItem - > setTransformOriginPoint ( resetButtonRect ( ) . topLeft ( ) * - 1 ) ;
mResetSvgItem - > setRotation ( - mStartAngle ) ;
mResetSvgItem - > setRotation ( rotation ( ) - mStartAngle ) ;
//mResetSvgItem->translate(resetButtonRect().left(), resetButtonRect().top());--
mResizeSvgItem - > setTransformOriginPoint ( resizeButtonRect ( ) . topLeft ( ) * - 1 ) ;
mReset SvgItem - > setPos ( pos_reset_x , pos_reset_y ) ;
mResizeSvgItem - > setRotation ( rotation ( ) - mStartAngle ) ;
//mResetSvgItem->scale(scale * antiSc, scale * antiSc);//this do not impact the bounding box of thr svg item...
mRotateSvgItem - > setTransformOriginPoint ( rotateButtonRect ( ) . topLeft ( ) * - 1 ) ;
mResetSvgItem - > setScale ( scale ) ; //this do not impact the bounding box of thr svg item...
mRotateSvgItem - > setRotation ( rotation ( ) - mStartAngle ) ;
// Determine and apply the position on the resize button object.
//------------------------------------------------------------
qreal pos_resize_x = resizeButtonRect ( ) . topLeft ( ) . x ( ) * co ;
qreal pos_resize_y = - ( resizeButtonRect ( ) . topLeft ( ) . x ( ) ) * si + resizeButtonRect ( ) . topLeft ( ) . y ( ) ;
qDebug ( ) < < " pos_resize_x = " < < pos_resize_x < < " pos_resize_y = " < < pos_resize_y ;
// mResizeSvgItem->setPos(resizeButtonRect().topLeft() + rect().center());
mResizeSvgItem - > setPos ( pos_resize_x , pos_resize_y ) ;
mResizeSvgItem - > resetTransform ( ) ;
mResizeSvgItem - > setPos ( - pos_resize_x , - pos_resize_y ) ;
//mResizeSvgItem->rotate(-mStartAngle);--
mResizeSvgItem - > setRotation ( - mStartAngle ) ;
//mResizeSvgItem->translate(-resizeButtonRect().left(), -resizeButtonRect().top());--
mResizeSvgItem - > setPos ( pos_resize_x , pos_resize_y ) ;
// mResizeSvgItem->scale(scale * antiSc, scale * antiSc);//this do not impact the bounding box of thr svg item...
mResizeSvgItem - > setScale ( scale ) ; //this do not impact the bounding box of thr svg item...
// Determine and apply the position on the rotate button object.
//--------------------------------------------------------------
qreal qPow_x = qPow ( rotateButtonRect ( ) . topLeft ( ) . x ( ) , 2 ) ;
qreal qPow_y = qPow ( rotateButtonRect ( ) . topLeft ( ) . y ( ) , 2 ) ;
qreal module_rotate_pos = qSqrt ( qPow_x + qPow_y ) ;
qreal arg_rotate_pos = ( qAtan2 ( rotateButtonRect ( ) . topLeft ( ) . y ( ) , rotateButtonRect ( ) . topLeft ( ) . x ( ) ) ) ; //argument in radian
qreal co_r = cos ( - mStartAngle * PI / 180 + arg_rotate_pos ) ; // cos(rad)
qreal si_r = sin ( - mStartAngle * PI / 180 + arg_rotate_pos ) ; //sin(rad)
qreal pos_rotate_x = ( module_rotate_pos * co_r ) ;
qreal pos_rotate_y = ( module_rotate_pos * si_r ) ;
mRotateSvgItem - > setPos ( pos_rotate_x , pos_rotate_y ) ;
//mRotateSvgItem->setPos(rotateButtonRect().topLeft() + rect().center()); --
mRotateSvgItem - > resetTransform ( ) ;
mRotateSvgItem - > setPos ( - pos_rotate_x , - pos_rotate_y ) ;
//mRotateSvgItem->rotate(-mStartAngle);--
mRotateSvgItem - > setRotation ( - mStartAngle ) ;
mRotateSvgItem - > setPos ( pos_rotate_x , pos_rotate_y ) ;
//mRotateSvgItem->scale(scale, scale);//this do not impact the bounding box of thr svg item...
mRotateSvgItem - > setScale ( scale ) ; //this do not impact the bounding box of thr svg item...
//qDebug()<<"UBGraphicsProtractor scale()"<<"scale ="<<scale<<"antiSc = "<<antiSc <<"mScaleFactor ="<<mScaleFactor;
}
}
qreal scale = markerSizeReference ( ) . width ( ) / mMarkerSvgItem - > boundingRect ( ) . width ( ) ;
mMarkerSvgItem - > setTransformOriginPoint ( markerButtonRect ( ) . topLeft ( ) * - 1 ) ;
mMarkerSvgItem - > setRotation ( rotation ( ) - mStartAngle - mCurrentAngle ) ;
qreal pos_marker_x = markerButtonRect ( ) . topLeft ( ) . x ( ) * co ;
qreal pos_marker_y = - ( markerButtonRect ( ) . topLeft ( ) . x ( ) ) * si + markerButtonRect ( ) . topLeft ( ) . y ( ) ;
// mMarkerSvgItem->setPos(markerButtonRect().topLeft() + rect().center()); --
mMarkerSvgItem - > setPos ( pos_marker_x , pos_marker_y ) ;
mMarkerSvgItem - > resetTransform ( ) ;
//mMarkerSvgItem->setPos(-markerButtonRect().left(), -markerButtonRect().top());--
mMarkerSvgItem - > setPos ( - pos_marker_x , - pos_marker_y ) ;
//mMarkerSvgItem->rotate(- mStartAngle - mCurrentAngle);
mMarkerSvgItem - > setRotation ( - mStartAngle - mCurrentAngle ) ;
mMarkerSvgItem - > setPos ( pos_marker_x , pos_marker_y ) ;
//mMarkerSvgItem->setPos(markerButtonRect().left(), markerButtonRect().top());--
//mMarkerSvgItem->scale(scale, scale);//this do not impact the bounding box of thr svg item...
mMarkerSvgItem - > setScale ( scale ) ; //this do not impact the bounding box of thr svg item...
mCloseSvgItem - > setVisible ( mShowButtons ) ;
mCloseSvgItem - > setVisible ( mShowButtons ) ;
mResetSvgItem - > setVisible ( mShowButtons ) ;
mResetSvgItem - > setVisible ( mShowButtons ) ;
mResizeSvgItem - > setVisible ( mShowButtons ) ;
mResizeSvgItem - > setVisible ( mShowButtons ) ;
mRotateSvgItem - > setVisible ( mShowButtons ) ;
mRotateSvgItem - > setVisible ( mShowButtons ) ;
mMarkerSvgItem - > setVisible ( true ) ;
mMarkerSvgItem - > setVisible ( true ) ;
}
}
@ -670,26 +555,25 @@ UBGraphicsProtractor::Tool UBGraphicsProtractor::toolFromPos(QPointF pos)
t . rotate ( mCurrentAngle ) ;
t . rotate ( mCurrentAngle ) ;
QPointF p2 = t . map ( pos ) ;
QPointF p2 = t . map ( pos ) ;
qDebug ( ) < < " UBGraphicsProtractor toolFromPos() " < < " p1= " < < p1 < < " p2 = " < < p2 < < " closeButtonRect_topLeft= " ;
qDebug ( ) < < " closeButtonRect_topleft " < < closeButtonRect ( ) . topLeft ( ) < < " closeButtonRect_width " < < closeButtonRect ( ) . width ( ) ;
if ( resizeButtonRect ( ) . contains ( p1 . x ( ) , p1 . y ( ) ) )
if ( resizeButtonRect ( ) . contains ( p1 . x ( ) , p1 . y ( ) ) )
//if (resizeButtonRect().contains(p1))
return Resize ;
return Resize ;
else if ( closeButtonRect ( ) . contains ( p1 ) )
else if ( closeButtonRect ( ) . contains ( p1 ) )
{
qDebug ( ) < < " UBGraphicsProtractor toolFromPos() " < < " closeButtonRect_Topleft= " < < closeButtonRect ( ) . topLeft ( ) ;
return Close ;
return Close ;
}
else if ( resetButtonRect ( ) . contains ( p1 ) )
else if ( resetButtonRect ( ) . contains ( p1 ) )
return Reset ;
return Reset ;
else if ( rotateButtonRect ( ) . contains ( p1 ) )
else if ( rotateButtonRect ( ) . contains ( p1 ) )
return Rotate ;
return Rotate ;
else if ( markerButtonRect ( ) . contains ( p2 ) )
else if ( markerButtonRect ( ) . contains ( p2 ) )
return MoveMarker ;
return MoveMarker ;
else if ( line . length ( ) < = radius ( ) )
else if ( line . length ( ) < = radius ( ) )
return Move ;
return Move ;
else
else
return None ;
return None ;
}
}