Skip to content

Commit

Permalink
Fix contact extents (#11362)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaksKBV authored and adeas31 committed Oct 12, 2023
1 parent 34d9b6e commit e03202a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
16 changes: 10 additions & 6 deletions OMEdit/OMEditLIB/Element/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1189,10 +1189,10 @@ ModelInstance::CoordinateSystem Element::getCoOrdinateSystemNew() const
{
ModelInstance::CoordinateSystem coordinateSystem;
if (mpModel->isConnector()) {
if (mpGraphicsView->getViewType() == StringHandler::Icon) {
coordinateSystem = mpModel->getAnnotation()->getIconAnnotation()->mMergedCoOrdinateSystem;
} else {
if ((mpGraphicsView->getViewType() == StringHandler::Diagram) && canUseDiagramAnnotation()) {
coordinateSystem = mpModel->getAnnotation()->getDiagramAnnotation()->mMergedCoOrdinateSystem;
} else {
coordinateSystem = mpModel->getAnnotation()->getIconAnnotation()->mMergedCoOrdinateSystem;
}
} else {
coordinateSystem = mpModel->getAnnotation()->getIconAnnotation()->mMergedCoOrdinateSystem;
Expand Down Expand Up @@ -3099,15 +3099,19 @@ void Element::updateToolTip()
* then we should not use the diagram annotation.
* \return
*/
bool Element::canUseDiagramAnnotation()
bool Element::canUseDiagramAnnotation() const
{
Element *pElement = this;
while (pElement->getParentElement()) {
if (getElementType() == Element::Port)
return false;

Element *pElement = getParentElement();
while (pElement) {
if (pElement->getElementType() == Element::Port) {
return false;
}
pElement = pElement->getParentElement();
}

return true;
}

Expand Down
6 changes: 3 additions & 3 deletions OMEdit/OMEditLIB/Element/Element.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ class Element : public QObject, public QGraphicsItem
bool isCondition() const;
GraphicsView* getGraphicsView() {return mpGraphicsView;}
Element *getReferenceElement() {return mpReferenceElement;}
Element* getParentElement() {return mpParentElement;}
Element* getParentElement() const {return mpParentElement;}
Element* getRootParentElement();
ElementType getElementType() {return mElementType;}
ElementType getElementType() const {return mElementType;}
QString getTransformationString() {return mTransformationString;}
void setDialogAnnotation(QStringList dialogAnnotation) {mDialogAnnotation = dialogAnnotation;}
QStringList getDialogAnnotation() {return mDialogAnnotation;}
Expand Down Expand Up @@ -387,7 +387,7 @@ class Element : public QObject, public QGraphicsItem
static QString getParameterDisplayStringFromExtendsParameters(ModelInstance::Model *pModel, QString parameterName, QString modifierString);
static bool checkEnumerationDisplayString(QString &displayString, const QString &typeName);
void updateToolTip();
bool canUseDiagramAnnotation();
bool canUseDiagramAnnotation() const;
signals:
void added();
void transformChange(bool positionChanged);
Expand Down

0 comments on commit e03202a

Please sign in to comment.