isis/src/qisis/objs/RubberBandTool/RubberBandTool.cpp
QPoint RubberBandTool::snapMouse(QPoint p) {
    if (p_vertices->size()) {
      QPoint lastVertex = p_vertices->at(p_vertices->size() - 1);

      int deltaX = abs(p.x() - lastVertex.x());
      int deltaY = abs(p.y() - lastVertex.y());

      if (deltaX > deltaY)
        p.setY(lastVertex.y());
      else
        p.setX(lastVertex.x());
    }

    return p;
  }
/**
   * moves the mouse's location p to the nearest axis
   *
   * @param p The mouse's current location
   *
   * @returns The snapped point
   */
moves the mouse's location p to the nearest axis
@param p The mouse's current location

@returns The snapped point
moves the mouse ' s location p to the nearest axis @param p The mouse ' s current location @returns The snapped point
QPoint RubberBandTool::snapMouse(QPoint p) {
    if (p_vertices->size()) {
      QPoint lastVertex = p_vertices->at(p_vertices->size() - 1);
      int deltaX = abs(p.x() - lastVertex.x());
      int deltaY = abs(p.y() - lastVertex.y());
      if (deltaX > deltaY)
        p.setY(lastVertex.y());
      else
        p.setX(lastVertex.x());
    }
    return p;
  }
QPoint RubberBandTool :: snapMouse ( QPoint p ) { if ( p_vertices -> size ( ) ) { QPoint lastVertex = p_vertices -> at ( p_vertices -> size ( ) - 1 ) ; int deltaX = abs ( p . x ( ) - lastVertex . x ( ) ) ; int deltaY = abs ( p . y ( ) - lastVertex . y ( ) ) ; if ( deltaX > deltaY ) p . setY ( lastVertex . y ( ) ) ; else p . setX ( lastVertex . x ( ) ) ; } return p ; }
moves the mouse's location p to the nearest axis
 @param p The mouse's current location
moves the mouse ' s location p to the nearest axis @param p The mouse ' s current location