homescreenapp/hsutils/src/hswidgetpositioningonwidgetmove.cpp
changeset 90 3ac3aaebaee5
parent 81 7dd137878ff8
equal deleted inserted replaced
86:e4f038c420f7 90:3ac3aaebaee5
   486 /*!
   486 /*!
   487     Create the vertical line for horizontal snap guidance
   487     Create the vertical line for horizontal snap guidance
   488 */
   488 */
   489 void HsSnapToLines::createVerticalLine()
   489 void HsSnapToLines::createVerticalLine()
   490 {
   490 {
   491     if (mRectLieAbove) {
   491     qreal top = qMin( mInactiveRectToCompare.top(), mMovingRect.top());
   492         mVerticalLine.setP1(QPointF(mMinDistancePosition, mInactiveRectToCompare.top()));
   492     qreal bottom = qMax(mInactiveRectToCompare.bottom(), mMovingRect.bottom()); 
   493         mVerticalLine.setP2(QPointF(mMinDistancePosition, mMovingRect.bottom()));
   493     mVerticalLine.setP1(QPointF(mMinDistancePosition, top));
   494     }
   494     mVerticalLine.setP2(QPointF(mMinDistancePosition, bottom));
   495     else {
       
   496         mVerticalLine.setP1(QPointF(mMinDistancePosition, mInactiveRectToCompare.bottom()));
       
   497         mVerticalLine.setP2(QPointF(mMinDistancePosition, mMovingRect.top()));
       
   498     }
       
   499 }
   495 }
   500 
   496 
   501 /*!
   497 /*!
   502     Check if the inactive rect being compared with moving rect lies on left or right of moving rect.
   498     Check if the inactive rect being compared with moving rect lies on left or right of moving rect.
   503 */
   499 */
   783 /*!
   779 /*!
   784     Create the horizontal line for vertical snap guidance
   780     Create the horizontal line for vertical snap guidance
   785 */
   781 */
   786 void HsSnapToLines::createHorizontalLine()
   782 void HsSnapToLines::createHorizontalLine()
   787 {
   783 {
   788     if (mRectLieLeft) {
   784     qreal left = qMin( mInactiveRectToCompare.left(), mMovingRect.left());
   789         //save the points for the Horizontal line
   785     qreal right = qMax(mInactiveRectToCompare.right(), mMovingRect.right()); 
   790         mHorizontalLine.setP1(QPointF(mInactiveRectToCompare.left(), mMinDistancePosition));
   786     mHorizontalLine.setP1(QPointF(left, mMinDistancePosition));
   791         mHorizontalLine.setP2(QPointF(mMovingRect.right(), mMinDistancePosition));
   787     mHorizontalLine.setP2(QPointF(right, mMinDistancePosition));
   792     }
       
   793     else {
       
   794         //save the points for the Horizontal line
       
   795         mHorizontalLine.setP1(QPointF(mInactiveRectToCompare.right(), mMinDistancePosition));
       
   796         mHorizontalLine.setP2(QPointF(mMovingRect.left(), mMinDistancePosition));
       
   797     }
       
   798 }
   788 }
   799 
   789 
   800 /*!
   790 /*!
   801     Extend the Vertical line on both side of reference(snapping) rectancles.
   791     Extend the Vertical line on both side of reference(snapping) rectancles.
   802 */
   792 */