Skip to content

Commit

Permalink
Improve the rendering of lines with thickness less than 1 (OpenModeli…
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Jun 14, 2024
1 parent aeb305e commit 7a7d152
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions OMEdit/OMEditLIB/Annotations/ShapeAnnotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ void ShapeAnnotation::applyLinePattern(QPainter *painter)
* Some old issues with nice use cases #3222, #2272, #2268.
*/
qreal thickness = mLineThickness;

qreal curScale = 0.0;
if ((mpGraphicsView && mpGraphicsView->isRenderingLibraryPixmap()) || (mpParentComponent && mpParentComponent->getGraphicsView()->isRenderingLibraryPixmap())) {
thickness = mLineThickness + 3.0;
Expand All @@ -522,13 +521,13 @@ void ShapeAnnotation::applyLinePattern(QPainter *painter)
qreal yScale = qSqrt(m22*m22 + m21*m21);
curScale = qMin(xScale, yScale);

if (mLineThickness > 0.0 && mLineThickness < 1.0 && curScale < 1.0) {
if (mLineThickness > 0.0 && mLineThickness < 1.0 && curScale < 2.0) {
thickness = 1.0;
}
}

QPen pen(QBrush(mLineColor), thickness, StringHandler::getLinePatternType(mLinePattern), Qt::FlatCap, Qt::MiterJoin);
if (qFuzzyCompare(mLineThickness, 0.0) || (mpParentComponent && mLineThickness < 1.0 && curScale < 1.0)) {
if (qFuzzyCompare(mLineThickness, 0.0) || (mpParentComponent && mLineThickness < 1.0 && curScale < 2.0)) {
pen.setCosmetic(true);
}
pen.setMiterLimit(1);
Expand Down

0 comments on commit 7a7d152

Please sign in to comment.