[Uml-devel] kdesdk/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Sun Oct 3 11:29:39 UTC 2004


CVS commit by okellogg: 

Fix bug 85377 (move multiple objects with gridsnap.)


  M +3 -2      ChangeLog   1.36
  M +13 -14    umbrello/umlwidget.cpp   1.106


--- kdesdk/umbrello/ChangeLog  #1.35:1.36
@@ -8,6 +8,7 @@
 
 * Bugs fixed / wishes implemented (see http://bugs.kde.org)
-80405 80559 86083 86952 86958 87111 87537 87995 88152 88245
-88415 88954 89334 89553 89579 89582 89699 89903 90102 
+62321 80405 80559 85377 86083 86952 86958 87111 87537 87995
+88152 88245 88415 88954 89334 89553 89579 89582 89699 89903
+90102 
 
 

--- kdesdk/umbrello/umbrello/umlwidget.cpp  #1.105:1.106
@@ -186,5 +186,6 @@ Uml::IDType UMLWidget::getID() const {
 QPoint UMLWidget::doMouseMove(QMouseEvent* me) {
         int newX = 0, newY = 0, count;
-        int moveX, moveY;
+        int moveX = (int)me->x();
+        int moveY = (int)me->y();
         int maxX = m_pView->canvas()->width();
         int maxY = m_pView->canvas()->height();
@@ -196,14 +197,9 @@ QPoint UMLWidget::doMouseMove(QMouseEven
         count = m_pView->getSelectCount();
 
-        //If not m_bStartMove means moving as part of selection
-        //me->pos() will have the amount we need to move.
-        if(!m_bStartMove) {
-                moveX = (int)me->x();
-                moveY = (int)me->y();
-        } else {
+        if (m_bStartMove) {
                 //we started the move so..
-                //move any others we are selected
-                moveX = (int)me->x() - m_nOldX - m_nPressOffsetX;
-                moveY = (int)me->y() - m_nOldY - m_nPressOffsetY;
+                //move any others we have selected
+                moveX -= m_nOldX + m_nPressOffsetX;
+                moveY -= m_nOldY + m_nPressOffsetY;
 
                 //if mouse moves off the edge of the canvas this moves the widget to 0 or canvasSize
@@ -215,4 +211,8 @@ QPoint UMLWidget::doMouseMove(QMouseEven
                 }
 
+                if (!m_bIgnoreSnapToGrid) {
+                        moveX = m_pView->snappedX( moveX + getX() ) - getX();
+                        moveY = m_pView->snappedY( moveY + getY() ) - getY();
+                }
                 if( count > 1 ) {
                         if( m_pView -> getType() == dt_Sequence ) {
@@ -224,10 +224,9 @@ QPoint UMLWidget::doMouseMove(QMouseEven
         }
         newX = getX() + moveX;
-        if (! m_bIgnoreSnapToGrid)
-                newX = m_pView->snappedX( newX );
         newY = getY() + moveY;
-        if (! m_bIgnoreSnapToGrid)
+        if (m_bStartMove && !m_bIgnoreSnapToGrid) {
+                newX = m_pView->snappedX( newX );
                 newY = m_pView->snappedY( newY );
-
+        }
         newX = newX<0 ? 0 : newX;
         newY = newY<0 ? 0 : newY;






More information about the umbrello-devel mailing list