[Uml-devel] KDE/kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Fri May 27 11:52:43 UTC 2005
SVN commit 418815 by okellogg:
mouseMoveEvent(): Prevent the moving vertex from disappearing underneath a
widget, else there's no way to get it back.
The current behavior is somewhat jerky - improvements are very welcome :)
BUG:106356
M +26 -0 associationwidget.cpp
--- trunk/KDE/kdesdk/umbrello/umbrello/associationwidget.cpp #418814:418815
@@ -2411,6 +2411,32 @@
p.setY(newY);
}
+ // Prevent the moving vertex from disappearing underneath a widget
+ // (else there's no way to get it back.)
+ UMLWidget *onW = m_pView->testOnWidget(p);
+ if (onW) {
+ const int pX = p.x();
+ const int pY = p.y();
+ const int wX = onW->getX();
+ const int wY = onW->getY();
+ const int wWidth = onW->getWidth();
+ const int wHeight = onW->getHeight();
+ if (pX > wX && pX < wX + wWidth) {
+ const int midX = wX + wWidth / 2;
+ if (pX <= midX)
+ p.setX(wX);
+ else
+ p.setX(wX + wWidth);
+ }
+ if (pY > wY && pY < wY + wHeight) {
+ const int midY = wY + wHeight / 2;
+ if (pY <= midY)
+ p.setY(wY);
+ else
+ p.setY(wY + wHeight);
+ }
+ }
+
//move event called now
QMoveEvent m(p, oldp);
moveEvent(&m);
More information about the umbrello-devel
mailing list