Skip to content

Commit 2c40385

Browse files
authored
Fix rendering of ellipse connectors when redrawn because of connection (#11254)
Fixes #11247 Only adjust the connection start and end if the connector is a square
1 parent beb80f4 commit 2c40385

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

OMEdit/OMEditLIB/Annotations/EllipseAnnotation.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,13 @@ void EllipseAnnotation::paint(QPainter *painter, const QStyleOptionGraphicsItem
167167
*/
168168
void EllipseAnnotation::drawAnnotation(QPainter *painter, bool scene)
169169
{
170-
// first we invert the painter since we have our coordinate system inverted.
171-
// inversion is required to draw the elliptic curves at correct angles.
172-
painter->scale(1.0, -1.0);
173170
QRectF boundingRectangle = boundingRect();
174-
if (scene) {
175-
boundingRectangle = mapToScene(boundingRect()).boundingRect();
171+
if (!scene) {
172+
// first we invert the painter since we have our coordinate system inverted.
173+
// inversion is required to draw the elliptic curves at correct angles.
174+
painter->scale(1.0, -1.0);
175+
painter->translate(0, ((-boundingRectangle.top()) - boundingRectangle.bottom()));
176176
}
177-
painter->translate(0, ((-boundingRectangle.top()) - boundingRectangle.bottom()));
178177
applyLinePattern(painter);
179178
if (mClosure != StringHandler::ClosureNone) {
180179
applyFillPattern(painter);
@@ -249,7 +248,7 @@ QString EllipseAnnotation::getShapeAnnotation()
249248
// get the closure
250249
if (mClosure.isDynamicSelectExpression() || !((mStartAngle == 0 && mEndAngle == 360 && mClosure.toQString().compare(QStringLiteral("EllipseClosure.Chord")) == 0)
251250
|| (!(mStartAngle == 0 && mEndAngle == 360) && mClosure.toQString().compare(QStringLiteral("EllipseClosure.Radial")) == 0))) {
252-
annotationString.append(QString("closure=%1").append(mClosure.toQString()));
251+
annotationString.append(QString("closure=%1").arg(mClosure.toQString()));
253252
}
254253
return QString("Ellipse(").append(annotationString.join(",")).append(")");
255254
}

OMEdit/OMEditLIB/Annotations/LineAnnotation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,10 +1452,10 @@ PointArrayAnnotation LineAnnotation::adjustPointsForDrawing() const
14521452
{
14531453
PointArrayAnnotation points = mPoints;
14541454
if (isConnection()) {
1455-
if (mpStartElement && points.size() > 0) {
1455+
if (mpStartElement && (points.size() > 0) && qFuzzyCompare(mpStartElement->sceneBoundingRect().width(), mpStartElement->sceneBoundingRect().height())) {
14561456
points.setPoint(0, mpStartElement->sceneBoundingRect().center());
14571457
}
1458-
if (mpEndElement && points.size() > 1) {
1458+
if (mpEndElement && (points.size() > 1) && qFuzzyCompare(mpEndElement->sceneBoundingRect().width(), mpEndElement->sceneBoundingRect().height())) {
14591459
points.setPoint(points.size() - 1, mpEndElement->sceneBoundingRect().center());
14601460
}
14611461
}

0 commit comments

Comments
 (0)