Skip to content
Permalink
Browse files

Simplify angle correction

  • Loading branch information
jdugge committed Feb 20, 2019
1 parent 29a5bd9 commit 9d530e1fe7b4c5bcabc94356c7edfc41e9b87a0a
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/gui/qgsadvanceddigitizingcanvasitem.cpp
@@ -128,20 +128,24 @@ void QgsAdvancedDigitizingCanvasItem::paint( QPainter *painter )
double a0, a;
if ( mAdvancedDigitizingDockWidget->constraintAngle()->relative() && nPoints > 2 )
{
a0 = std::atan2( -( prevPoint.y() - penulPoint.y() ), prevPoint.x() - penulPoint.x() ) + canvasRotationRad;
a0 = std::atan2( -( prevPoint.y() - penulPoint.y() ), prevPoint.x() - penulPoint.x() );
}
else
{
a0 = canvasRotationRad;
a0 = 0;
}
if ( mAdvancedDigitizingDockWidget->constraintAngle()->isLocked() )
{
a = a0 - mAdvancedDigitizingDockWidget->constraintAngle()->value() * M_PI / 180;
}
else
{
a = std::atan2( -( curPoint.y() - prevPoint.y() ), curPoint.x() - prevPoint.x() ) + canvasRotationRad;
a = std::atan2( -( curPoint.y() - prevPoint.y() ), curPoint.x() - prevPoint.x() );
}

a0 += canvasRotationRad;
a += canvasRotationRad;

painter->setPen( mConstruction2Pen );
painter->drawArc( QRectF( prevPointPix.x() - 20,
prevPointPix.y() - 20,

0 comments on commit 9d530e1

Please sign in to comment.
You can’t perform that action at this time.