[Uml-devel] KDE/kdesdk/umbrello/umbrello
Sharan Rao
sharanrao at gmail.com
Sun Aug 5 20:54:07 UTC 2007
SVN commit 696755 by sharan:
Fixed a bug which hapenned while moving widgets , which led to improper functionality of "Undo Move Widget"
The same variables m_oldX and m_oldY (which are supposed to only keep track of "old" static positions) were being
used previously in UMLWidgetController to keep track of the previous X and Y positions in the dragged path ( the
path being dynamic). New variables m_prevX and m_prevY are introduced for this purpose ( dynamic tracking) now.
M +10 -7 umlwidgetcontroller.cpp
M +6 -0 umlwidgetcontroller.h
--- trunk/KDE/kdesdk/umbrello/umbrello/umlwidgetcontroller.cpp #696754:696755
@@ -40,9 +40,12 @@
UMLWidgetController::UMLWidgetController(UMLWidget *widget) {
m_widget = widget;
+
+ m_oldX = m_oldY = 0;
m_pressOffsetX = m_pressOffsetY = 0;
- m_oldX = m_oldY = 0;
+ m_prevX = m_prevY = 0;
m_oldW = m_oldH = 0;
+
m_minSelectedX = m_minSelectedY = m_maxSelectedX = m_maxSelectedY = 0;
m_shiftPressed = false;
@@ -375,8 +378,8 @@
m_pressOffsetX = me->x() - m_widget->getX();
m_pressOffsetY = me->y() - m_widget->getY();
- m_oldX = m_widget->getX();
- m_oldY = m_widget->getY();
+ m_prevX = m_oldX = m_widget->getX();
+ m_prevY = m_oldY = m_widget->getY();
m_oldW = m_widget->width();
m_oldH = m_widget->height();
@@ -540,13 +543,13 @@
<< " 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 newX = me->x() + m_widget->getX() - m_prevX - m_pressOffsetX;
+ int newY = me->y() + m_widget->getY() - m_prevY - m_pressOffsetY;
int maxX = m_widget->m_pView->canvas()->width();
int maxY = m_widget->m_pView->canvas()->height();
- m_oldX = newX;
- m_oldY = newY;
+ m_prevX = newX;
+ m_prevY = newY;
if (newX + (m_minSelectedX - m_widget->getX()) < 0) {
//kDebug() << "UMLWidgetController::getPosition: got into cond.1";
--- trunk/KDE/kdesdk/umbrello/umbrello/umlwidgetcontroller.h #696754:696755
@@ -461,6 +461,12 @@
int m_oldX, m_oldY;
/**
+ * The previous recorded X/Y position of the widget during its movement
+ * This keeps changing as the widget is dragged along its path
+ */
+ int m_prevX, m_prevY;
+
+ /**
* The width/height the widget had when the resize started.
*/
int m_oldW, m_oldH;
More information about the umbrello-devel
mailing list