changed old compass behavior to match with new strokes simplification

preferencesAboutTextFull
Clément Fauconnier 7 years ago
parent 66447700d7
commit 1dcd59e307
  1. 1
      src/domain/UBGraphicsScene.cpp
  2. 21
      src/frameworks/UBGeometryUtils.cpp

@ -1094,6 +1094,7 @@ void UBGraphicsScene::drawArcTo(const QPointF& pCenterPoint, qreal pSpanAngle)
penWidth /= UBApplication::boardController->currentZoom(); penWidth /= UBApplication::boardController->currentZoom();
mArcPolygonItem = arcToPolygonItem(QLineF(pCenterPoint, mPreviousPoint), pSpanAngle, penWidth); mArcPolygonItem = arcToPolygonItem(QLineF(pCenterPoint, mPreviousPoint), pSpanAngle, penWidth);
mArcPolygonItem->setFillRule(Qt::WindingFill);
mArcPolygonItem->setStroke(mCurrentStroke); mArcPolygonItem->setStroke(mCurrentStroke);
mAddedItems.insert(mArcPolygonItem); mAddedItems.insert(mArcPolygonItem);
addItem(mArcPolygonItem); addItem(mArcPolygonItem);

@ -225,21 +225,12 @@ QPolygonF UBGeometryUtils::arcToPolygon(const QLineF& startRadius, qreal spanAng
endAngleInDegrees = - endAngleInDegrees; endAngleInDegrees = - endAngleInDegrees;
spanAngleInDegrees = - spanAngleInDegrees; spanAngleInDegrees = - spanAngleInDegrees;
if (overlap) painterPath.setFillRule(Qt::WindingFill);
{ painterPath.arcTo(innerSquare, startAngleInDegrees, spanAngleInDegrees);
painterPath.addEllipse(outerSquare); painterPath.arcTo(endSquare, 180.0 + endAngleInDegrees, spanAngleInDegrees > 0 ? -180.0 : 180.0);
QPainterPath innerPainterPath; painterPath.arcTo(outerSquare, endAngleInDegrees, - spanAngleInDegrees);
innerPainterPath.addEllipse(innerSquare); painterPath.arcTo(startSquare, startAngleInDegrees, spanAngleInDegrees > 0 ? -180.0 : 180.0);
painterPath = painterPath.subtracted(innerPainterPath); painterPath.closeSubpath();
}
else
{
painterPath.arcTo(innerSquare, startAngleInDegrees, spanAngleInDegrees);
painterPath.arcTo(endSquare, 180.0 + endAngleInDegrees, spanAngleInDegrees > 0 ? -180.0 : 180.0);
painterPath.arcTo(outerSquare, endAngleInDegrees, - spanAngleInDegrees);
painterPath.arcTo(startSquare, startAngleInDegrees, spanAngleInDegrees > 0 ? -180.0 : 180.0);
painterPath.closeSubpath();
}
return painterPath.toFillPolygon(); return painterPath.toFillPolygon();
} }

Loading…
Cancel
Save