[Uml-devel] branches/KDE/3.5/kdesdk/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Tue Jun 19 06:01:47 UTC 2007


SVN commit 677414 by okellogg:

getPositionDifference(): Consider m_old{X,Y} on computing new{X,Y}.
Update m_old{X,Y} with the newly computed values.
BUG:137041


 M  +1 -0      ChangeLog  
 M  +24 -4     umbrello/umlwidgetcontroller.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #677413:677414
@@ -1,6 +1,7 @@
 Version 1.5.72
 
 * Bugs/wishes from http://bugs.kde.org:
+* Cannot move text and label correctly after enabling snap to grid (137041)
 * Wrong pascal code generation (146676)
 * Crash when linking to undefined xmi.id (146748)
 * End Activity Symbol gets invalid when line thickness is increased (146925)
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlwidgetcontroller.cpp #677413:677414
@@ -140,13 +140,17 @@
 
     if ((me->state() & Qt::ShiftButton) && (me->state() & Qt::ControlButton)) {
         //Move in Y axis
-        diffX = m_oldX - m_widget->getX();
+        diffX = 0;
     } else if ((me->state() & Qt::ShiftButton) || (me->state() & Qt::ControlButton)) {
         //Move in X axis
-        diffY = m_oldY - m_widget->getY();
+        diffY = 0;
     }
 
+    // kDebug() << "UMLWidgetController::mouseMoveEvent before constrainMovementForAllWidgets:"
+    //     << " diffX=" << diffX << ", diffY=" << diffY << endl;
     constrainMovementForAllWidgets(diffX, diffY);
+    // kDebug() << "UMLWidgetController::mouseMoveEvent after constrainMovementForAllWidgets:"
+    //     << " diffX=" << diffX << ", diffY=" << diffY << endl;
 
     //Nothing to move
     if (diffX == 0 && diffY == 0) {
@@ -172,6 +176,7 @@
         ++it;
         widget->getWidgetController()->moveWidgetBy(diffX, diffY);
     }
+    // kDebug() << endl;
 
     // Move any selected associations.
     AssociationWidgetList awl = m_widget->m_pView->getSelectedAssocs();
@@ -477,21 +482,36 @@
 }
 
 QPoint UMLWidgetController::getPositionDifference(QMouseEvent* me) {
-    int newX = me->x() - m_pressOffsetX;
-    int newY = me->y() - m_pressOffsetY;
+    /*
+    kDebug() << "UMLWidgetController::getPositionDifference: 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()
+        << " m_widget->getY=" << m_widget->getY() << ", m_oldY=" << m_oldY
+        << ", m_pressOffsetY=" << m_pressOffsetY << endl;
+     */
+    int newX = me->x() + m_widget->getX() - m_oldX - m_pressOffsetX;
+    int newY = me->y() + m_widget->getY() - m_oldY - m_pressOffsetY;
     int maxX = m_widget->m_pView->canvas()->width();
     int maxY = m_widget->m_pView->canvas()->height();
 
+    m_oldX = newX;
+    m_oldY = newY;
+
     if (newX + (m_minSelectedX - m_widget->getX()) < 0) {
+        //kDebug() << "UMLWidgetController::getPositionDifference: 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;
         newY = m_widget->getY() - m_minSelectedY;
     }
     if (newX + (m_maxSelectedX - m_widget->getX()) > maxX) {
+        //kDebug() << "UMLWidgetController::getPositionDifference: 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;
         newY = maxY - (m_maxSelectedY - m_widget->getY());
     }
 




More information about the umbrello-devel mailing list