Skip to content
Permalink
Browse files

Fix locking logic with X,Y locked and soft locks to angle (fixes #12940)

(cherry picked from commit 646b445)
  • Loading branch information
wonder-sk committed Jun 18, 2015
1 parent 48a51ff commit be0dae1971068ff0d977d167d94feb0594cdb919
Showing with 26 additions and 26 deletions.
  1. +26 −26 src/app/qgsadvanceddigitizingdockwidget.cpp
@@ -631,40 +631,40 @@ bool QgsAdvancedDigitizingDockWidget::applyConstraints( QgsMapMouseEvent* e )
double cosa = qCos( angleValue );
double sina = qSin( angleValue );
double v = ( point.x() - previousPt.x() ) * cosa + ( point.y() - previousPt.y() ) * sina ;
if ( mXConstraint->isLocked() || mYConstraint->isLocked() )
if ( mXConstraint->isLocked() && mYConstraint->isLocked() )
{
// perform both to detect errors in constraints
if ( mXConstraint->isLocked() )
// do nothing if both X,Y are already locked
}
else if ( mXConstraint->isLocked() )
{
if ( cosa == 0 )
{
if ( cosa == 0 )
{
res = false;
}
else
{
double x = mXConstraint->value();
if ( !mXConstraint->relative() )
{
x -= previousPt.x();
}
point.setY( previousPt.y() + x * sina / cosa );
}
res = false;
}
else if ( mYConstraint->isLocked() )
else
{
if ( sina == 0 )
double x = mXConstraint->value();
if ( !mXConstraint->relative() )
{
res = false;
x -= previousPt.x();
}
else
point.setY( previousPt.y() + x * sina / cosa );
}
}
else if ( mYConstraint->isLocked() )
{
if ( sina == 0 )
{
res = false;
}
else
{
double y = mYConstraint->value();
if ( !mYConstraint->relative() )
{
double y = mYConstraint->value();
if ( !mYConstraint->relative() )
{
y -= previousPt.y();
}
point.setX( previousPt.x() + y * cosa / sina );
y -= previousPt.y();
}
point.setX( previousPt.x() + y * cosa / sina );
}
}
else

0 comments on commit be0dae1

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