Skip to content

Commit

Permalink
Merge pull request #721 from mantidproject/feature/11709_Lineviewer_h…
Browse files Browse the repository at this point in the history
…andles

Feature/11709 lineviewer handles
  • Loading branch information
eXeC64 committed May 7, 2015
2 parents b02a1a0 + df466b7 commit 89f1778
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions Code/Mantid/MantidQt/SliceViewer/src/LineOverlay.cpp
Expand Up @@ -387,10 +387,21 @@ namespace SliceViewer
double distance = fabs( diff.x()*(current.y()-pixA.y()) - (current.x() - pixA.x())*diff.y() )
/ sqrt(diff.x()*diff.x() + diff.y()*diff.y());

// Margin of 6 pixels, and must be between the 2 limits
return ((distance < 7) &&
isBetween( current.x(), pixA.x(), pixB.x()) &&
isBetween( current.y(), pixA.y(), pixB.y()) );
// Margin of 6 pixels, and must be between the 2 limits (if the limits are not the same)
bool retval = false;
if (distance < 7)
{
retval = true;
if ((pixA.x() != pixB.x()) && (!isBetween( current.x(), pixA.x(), pixB.x())))
{
retval = false;
}
if ((pixA.y() != pixB.y()) && (!isBetween( current.y(), pixA.y(), pixB.y())))
{
retval = false;
}
}
return retval;
}

//-----------------------------------------------------------------------------------------------
Expand Down

0 comments on commit 89f1778

Please sign in to comment.