57 const static QPointF nullPoint(std::numeric_limits<qreal>::quiet_NaN(), std::numeric_limits<qreal>::quiet_NaN());
61 if (snapToAnyDirection ||
m_snapLine.isNull()) {
69 if (!poly.containsPoint(strokeBegin, Qt::OddEvenFill)) {
79 const QTransform inverse =
transform.inverted(&invertible);
86 const QPointF start = inverse.map(strokeBegin);
87 const QLineF verticalLine = QLineF(strokeBegin,
transform.map(start + QPointF(0, 1)));
88 const QLineF horizontalLine = QLineF(strokeBegin,
transform.map(start + QPointF(1, 0)));
100 invsqrlen = 1.0 / (dx2 + dy2);
163 QPointF intersection(0, 0);
166 QRect viewport= gc.viewport();
170 QPointF intersectTransformed(0, 0);
172 if (poly.containsPoint(initialTransform.inverted().map(mousePos), Qt::OddEvenFill)==
true){
174 if (fmod(QLineF(poly[0], poly[1]).angle(), 180.0)>=fmod(QLineF(poly[2], poly[3]).angle(), 180.0)+2.0 || fmod(QLineF(poly[0], poly[1]).angle(), 180.0)<=fmod(QLineF(poly[2], poly[3]).angle(), 180.0)-2.0) {
175 if (QLineF(poly[0], poly[1]).intersects(QLineF(poly[2], poly[3]), &intersection) != QLineF::NoIntersection) {
176 intersectTransformed = initialTransform.map(intersection);
177 snapLine = QLineF(intersectTransformed, mousePos);
179 bounds= QRect(snapLine.p1().toPoint(), snapLine.p2().toPoint());
181 if (
bounds.contains(intersectTransformed.toPoint())){
182 path2.moveTo(intersectTransformed);
183 path2.lineTo(snapLine.p2());
186 path2.moveTo(snapLine.p1());
187 path2.lineTo(snapLine.p2());
191 if (fmod(QLineF(poly[1], poly[2]).angle(), 180.0)>=fmod(QLineF(poly[3], poly[0]).angle(), 180.0)+2.0 || fmod(QLineF(poly[1], poly[2]).angle(), 180.0)<=fmod(QLineF(poly[3], poly[0]).angle(), 180.0)-2.0){
192 if (QLineF(poly[1], poly[2]).intersects(QLineF(poly[3], poly[0]), &intersection) != QLineF::NoIntersection) {
193 intersectTransformed = initialTransform.map(intersection);
194 snapLine = QLineF(intersectTransformed, mousePos);
196 bounds= QRect(snapLine.p1().toPoint(), snapLine.p2().toPoint());
199 if (
bounds.contains(intersectTransformed.toPoint())){
200 path2.moveTo(intersectTransformed);
201 path2.lineTo(snapLine.p2());
204 path2.moveTo(snapLine.p1());
205 path2.lineTo(snapLine.p2());
218 if (assistantVisible) {
226 drawError(gc, path, displayRenderInterface);
229 path.addPolygon(poly);
233 gc.setPen(QColor(0, 0, 0, 125));
240 QLineF line = QLineF(QPointF(0.0, y * step), QPointF(1.0, y * step));
242 path.moveTo(line.p1());
243 path.lineTo(line.p2());
247 QLineF line = QLineF(QPointF(x * step, 0.0), QPointF(x * step, 1.0));
249 path.moveTo(line.p1());
250 path.lineTo(line.p2());