| Summary: | Component Diagram, moving component results in an absurd shape of a self-association | ||
|---|---|---|---|
| Product: | [Applications] umbrello | Reporter: | Anton Pussep <anton> |
| Component: | general | Assignee: | Oliver Kellogg <okellogg> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Debian stable | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: | component diagram in which the error occurres | ||
|
Description
Anton Pussep
2007-07-12 14:36:10 UTC
Created attachment 21125 [details]
component diagram in which the error occurres
illustrates the error
Confirm. While moving the "PC Provider" component, there are error messages on the console, umbrello: updateAssociations: error from findInterceptOnEdge for assocType=502 ownWidget=Business Logic otherWidget=PC Provider SVN commit 687614 by okellogg:
mouseMoveEvent(): UMLWidget::adjustUnselectedAssocs() expects absolute coordinate.
getPosition(): New method, factored from getPositionDifference(), returns the
absolute coordinate.
getPositionDifference(): Use getPosition().
CCBUG:147810
M +18 -18 umlwidgetcontroller.cpp
M +12 -1 umlwidgetcontroller.h
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlwidgetcontroller.cpp #687613:687614
@@ -134,9 +134,9 @@
setSelectionBounds();
}
- QPoint positionDifference = getPositionDifference(me);
- int diffX = positionDifference.x();
- int diffY = positionDifference.y();
+ QPoint position = getPosition(me);
+ int diffX = position.x() - m_widget->getX();
+ int diffY = position.y() - m_widget->getY();
if ((me->state() & Qt::ShiftButton) && (me->state() & Qt::ControlButton)) {
//Move in Y axis
@@ -166,10 +166,7 @@
update = true;
lastUpdate.restart();
- // CHECK: UMLWidget::adjustUnselectedAssocs(x,y) appears to take absolute
- // values for x and y. Surprisingly, supplying diffX and diffY seems
- // to work all the same ?!?
- m_widget->adjustUnselectedAssocs(diffX, diffY);
+ m_widget->adjustUnselectedAssocs(position.x(), position.y());
}
while ((widget = it.current()) != 0) {
@@ -481,12 +478,12 @@
return biggestY;
}
-QPoint UMLWidgetController::getPositionDifference(QMouseEvent* me) {
+QPoint UMLWidgetController::getPosition(QMouseEvent* me) {
/*
- kDebug() << "UMLWidgetController::getPositionDifference: me->x=" << me->x()
+ kDebug() << "UMLWidgetController::getPosition: me->x=" << me->x()
<< " m_widget->getX=" << m_widget->getX() << ", m_oldX=" << m_oldX
<< ", m_pressOffsetX=" << m_pressOffsetX << endl;
- kDebug() << "UMLWidgetController::getPositionDifference: me->y=" << me->y()
+ kDebug() << "UMLWidgetController::getPosition: me->y=" << me->y()
<< " m_widget->getY=" << m_widget->getY() << ", m_oldY=" << m_oldY
<< ", m_pressOffsetY=" << m_pressOffsetY << endl;
*/
@@ -499,28 +496,31 @@
m_oldY = newY;
if (newX + (m_minSelectedX - m_widget->getX()) < 0) {
- //kDebug() << "UMLWidgetController::getPositionDifference: got into cond.1" << endl;
+ //kDebug() << "UMLWidgetController::getPosition: got into cond.1" << endl;
newX = m_widget->getX() - m_minSelectedX;
}
if (newY + (m_minSelectedY - m_widget->getY()) < 0) {
- //kDebug() << "UMLWidgetController::getPositionDifference: got into cond.2" << endl;
+ //kDebug() << "UMLWidgetController::getPosition: got into cond.2" << endl;
newY = m_widget->getY() - m_minSelectedY;
}
if (newX + (m_maxSelectedX - m_widget->getX()) > maxX) {
- //kDebug() << "UMLWidgetController::getPositionDifference: got into cond.3" << endl;
+ //kDebug() << "UMLWidgetController::getPosition: got into cond.3" << endl;
newX = maxX - (m_maxSelectedX - m_widget->getX());
}
if (newY + (m_maxSelectedY - m_widget->getY()) > maxY) {
- //kDebug() << "UMLWidgetController::getPositionDifference: got into cond.4" << endl;
+ //kDebug() << "UMLWidgetController::getPosition: got into cond.4" << endl;
newY = maxY - (m_maxSelectedY - m_widget->getY());
}
-
- newX -= m_widget->getX();
- newY -= m_widget->getY();
-
return QPoint(newX, newY);
}
+QPoint UMLWidgetController::getPositionDifference(QMouseEvent* me) {
+ QPoint newPoint = getPosition(me);
+ const int diffX = newPoint.x() - m_widget->getX();
+ const int diffY = newPoint.y() - m_widget->getY();
+ return QPoint(diffX, diffY);
+}
+
void UMLWidgetController::showPopupMenu(QMouseEvent *me) {
//TODO why this condition?
if (m_widget->m_pMenu) {
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlwidgetcontroller.h #687613:687614
@@ -362,10 +362,21 @@
int getBiggestY(const UMLWidgetList &widgetList);
/**
+ * Returns the adjusted position for the given mouse event.
+ * The adjusted position is computed using the current widget position
+ * m_widget->get{X,Y}(), the previous position m_old{X,Y}, and the
+ * mouse press offset m_pressOffset{X,Y}.
+ *
+ * @param me The QMouseEvent for which to get the adjusted position.
+ * @return A QPoint with the adjusted position.
+ */
+ QPoint getPosition(QMouseEvent *me);
+
+ /**
* Returns a QPoint with the new X and Y position difference of the mouse event
* respect to the position of the widget.
*
- * @param me The QMouseEVent to get the position to compare.
+ * @param me The QMouseEvent to get the position to compare.
* @return A QPoint with the position difference.
*/
QPoint getPositionDifference(QMouseEvent *me);
SVN commit 688175 by okellogg:
mouseMoveEvent(): Use raw pos of m_widget at call to UMLWidget::adjustUnselectedAssocs()
BUG:147810
M +1 -0 ChangeLog
M +1 -1 umbrello/umlwidgetcontroller.cpp
--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #688174:688175
@@ -7,6 +7,7 @@
* End Activity Symbol gets invalid when line thickness is increased (146925)
* The size of a fork/join is not restored (147069)
* Crash when changing the association type to containment (147202)
+* Moving component on diagram results in absurd shape of self-association (147810)
Version 1.5.71
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlwidgetcontroller.cpp #688174:688175
@@ -166,7 +166,7 @@
update = true;
lastUpdate.restart();
- m_widget->adjustUnselectedAssocs(position.x(), position.y());
+ m_widget->adjustUnselectedAssocs(m_widget->getX(), m_widget->getY());
}
while ((widget = it.current()) != 0) {
|