Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Proper handing of line thickness.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@25139 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Mar 18, 2015
1 parent 70799a2 commit 14d8de4
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions OMEdit/OMEditGUI/Annotations/ShapeAnnotation.cpp
Expand Up @@ -483,21 +483,22 @@ void ShapeAnnotation::applyLinePattern(QPainter *painter)
qreal thicknessFactor = mLineThickness / 0.5;
qreal thickness = thicknessFactor < 1 ? 1.0 : thicknessFactor;
QPen pen(mLineColor, thickness, StringHandler::getLinePatternType(mLinePattern), Qt::SquareCap, Qt::MiterJoin);
/*
Ticket #2272, Ticket #2268.
if thickness is greater than 2 then don't make the pen cosmetic since cosmetic pens don't change the width with respect to zoom.
*/
if (thickness <= 2)
{
/* Ticket #3222
* Make all the shapes use cosmetic pens so that they perserve their pen widht when scaled i.e zoomed in/out.
* Only shapes with border patterns raised & sunken don't use cosmetic pens. We need better handling of border patterns.
*/
if (mBorderPattern != StringHandler::BorderRaised && mBorderPattern != StringHandler::BorderSunken) {
pen.setCosmetic(true);
}
/* Set cosmetic pen for connection lines and lines drawn by individual shapes. */
if (dynamic_cast<LineAnnotation*>(this))
{
LineAnnotation *pLineAnnotation = dynamic_cast<LineAnnotation*>(this);
if (pLineAnnotation->getLineType() == LineAnnotation::ConnectionType || pLineAnnotation->getLineType() == LineAnnotation::ShapeType)
{
Component *pComponent = dynamic_cast<Component*>(parentItem());
if (pComponent && pComponent->isLibraryComponent()) {
/* Ticket #2272, Ticket #2268.
* If thickness is greater than 2 then don't make the pen cosmetic since cosmetic pens don't change the width with respect to zoom.
*/
if (thickness <= 2) {
pen.setCosmetic(true);
} else {
pen.setCosmetic(false);
}
}
painter->setPen(pen);
Expand Down

0 comments on commit 14d8de4

Please sign in to comment.