101 |
101 |
102 Result run(const QRectF &movingRect); |
102 Result run(const QRectF &movingRect); |
103 private: |
103 private: |
104 |
104 |
105 void createSnappableRectangles(const QList<QRectF> &inactiveRects); |
105 void createSnappableRectangles(const QList<QRectF> &inactiveRects); |
106 void checkForCenterSnapping(); |
|
107 void checkInactiveRectLieAboveOrBelowOfMovingRect(); |
106 void checkInactiveRectLieAboveOrBelowOfMovingRect(); |
|
107 void checkInactiveRectVerticalEdgesInRange(qreal movingRectVerticalEdgePosition); |
|
108 void checkInactiveRectBetterFitForHorizontalSnapping(qreal containerVerticalEdgeToInactiveRectVerticalEdge, |
|
109 qreal containerOtherVerticalEdgeToInactiveRectOtherVerticalEdge); |
108 void compareLeftSideOfMovingRectForSnapping(); |
110 void compareLeftSideOfMovingRectForSnapping(); |
109 void compareRightSideOfMovingRectForSnapping(); |
111 void compareRightSideOfMovingRectForSnapping(); |
110 void checkInactiveRectLieLeftOrRightOfMovingRect(); |
112 void checkInactiveRectLieLeftOrRightOfMovingRect(); |
|
113 void checkInactiveRectHorizontalEdgesInRange(qreal movingRectHorizontalEdgePosition); |
|
114 void checkInactiveRectBetterFitForVerticalSnapping(qreal containerHorizontalEdgeToInactiveRectHorizontalEdge, |
|
115 qreal containerOtherHorizontalEdgeToInactiveRectOtherHorizontalEdge); |
111 void compareTopOfMovingRectForSnapping(); |
116 void compareTopOfMovingRectForSnapping(); |
112 void compareBottomOfMovingRectForSnapping(); |
117 void compareBottomOfMovingRectForSnapping(); |
|
118 void createVerticalLine(); |
|
119 void createHorizontalLine(); |
113 void extendVerticalLine(); |
120 void extendVerticalLine(); |
114 void extendHorizontalLine(); |
121 void extendHorizontalLine(); |
115 void checkInactiveRectPositionToVerticalLine(); |
122 void checkInactiveRectPositionToVerticalLine(); |
116 void extendVerticalLineToIncludeInactiveRect(); |
123 void extendVerticalLineToIncludeInactiveRect(); |
117 void checkInactiveRectPositionToHorizontalLine(); |
124 void checkInactiveRectPositionToHorizontalLine(); |
126 QList<HsSnapRectangle> mInactiveSnapRects; |
133 QList<HsSnapRectangle> mInactiveSnapRects; |
127 |
134 |
128 QRectF mInactiveRectToCompare; |
135 QRectF mInactiveRectToCompare; |
129 HsSnapRectangle mInactiveSnapRectToCompare; |
136 HsSnapRectangle mInactiveSnapRectToCompare; |
130 QRectF mMovingRect; |
137 QRectF mMovingRect; |
|
138 |
|
139 qreal mMinDistancePosition; |
131 qreal mHorizontalSnapPosition; |
140 qreal mHorizontalSnapPosition; |
132 qreal mVerticalSnapPosition; |
141 qreal mVerticalSnapPosition; |
133 |
142 |
134 bool mHorizontalSnapFound; |
143 bool mHorizontalSnapFound; |
135 QLineF mVerticalLine; |
144 QLineF mVerticalLine; |
138 QLineF mHorizontalLine; |
147 QLineF mHorizontalLine; |
139 |
148 |
140 bool mRectLieAbove; |
149 bool mRectLieAbove; |
141 bool mLeftInRange; |
150 bool mLeftInRange; |
142 bool mRightInRange; |
151 bool mRightInRange; |
|
152 bool mIsBetterFitHorizontalSnap; |
|
153 qreal mDistanceVerticalEdges; |
|
154 qreal mVerticalEdgeToLeftOfInactiveRect; |
|
155 qreal mVerticalEdgeToRightOfInactiveRect; |
143 qreal mMinVerticalEdgesDistance; |
156 qreal mMinVerticalEdgesDistance; |
144 qreal mVerticalDistance; |
157 qreal mVerticalDistance; |
145 qreal mVerticalDistanceFromSelectedRect; |
158 qreal mVerticalDistanceFromSelectedRect; |
146 qreal mContainerVerticalEdgeDistance; |
159 qreal mContainerVerticalEdgeDistance; |
147 |
160 |
148 bool mRectLieLeft; |
161 bool mRectLieLeft; |
149 bool mTopInRange; |
162 bool mTopInRange; |
150 bool mBottomInRange; |
163 bool mBottomInRange; |
|
164 bool mIsBetterFitVerticalSnap; |
|
165 qreal mDistanceHorizontalEdges; |
|
166 qreal mHorizontalEdgeToTopOfInactiveRect; |
|
167 qreal mHorizontalEdgeToBottomOfInactiveRect; |
151 qreal mMinHorizontalEdgesDistance; |
168 qreal mMinHorizontalEdgesDistance; |
152 qreal mHorizontalDistance; |
169 qreal mHorizontalDistance; |
153 qreal mHorizontalDistanceFromSelectedRect; |
170 qreal mHorizontalDistanceFromSelectedRect; |
154 qreal mContainerHorizontalEdgeDistance; |
171 qreal mContainerHorizontalEdgeDistance; |
155 |
172 |