Bug 106356 - Line Vertex hidden in class diagrams
Summary: Line Vertex hidden in class diagrams
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Oliver Kellogg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-27 01:16 UTC by Tony Parent
Modified: 2005-05-27 21:03 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
class before (1.74 KB, image/gif)
2005-05-27 16:26 UTC, Tony Parent
Details
class after moving vertex (1.78 KB, image/gif)
2005-05-27 16:29 UTC, Tony Parent
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tony Parent 2005-05-27 01:16:21 UTC
Version:           kdesdk-050504 (using KDE KDE 3.4.0)
Installed from:    Compiled From Sources
Compiler:          gcc 
OS:                Linux

- Create a new class
- Draw a aggragation line that loops back on the same class
  (This happens when you have a "singleton" or other type
   of class that contains a pointer to itself.)
- Select one of the vertexes of the line and move it
  down under the class.
- You can no longer move that vertex out from under
  the class.

I only say to do the above in order to illistrate a problem that I have run into several times on class diagrams. Sometimes when I do a cut/paste from one class diagram to another, the singletons lines get moved around. Most of the time it is just messed up a little. Other times the lines end up under the class box, and there is no way to get ahold of the vertexes to move them out from under the box.
Comment 1 Oliver Kellogg 2005-05-27 08:53:02 UTC
In Umbrello svn head, I can't move the self association at all -
it is always placed at the top edge of the class.
Comment 2 Tony Parent 2005-05-27 16:26:53 UTC
Created attachment 11223 [details]
class before
Comment 3 Tony Parent 2005-05-27 16:29:51 UTC
Created attachment 11224 [details]
class after moving vertex

The attached file shows what happens when you grab one of the vertexes and move
it below the class. Selecting the association line shows the vertexes that are
still above the class but not the one under the class.

The previous attachment shows the before picture. (Sorry, I didn't put a
comment on that attachment.)
Comment 4 Oliver Kellogg 2005-05-27 19:50:40 UTC
Ah, okay. I had been trying to move the assoc by dragging a
_line_segment_ not a _vertex_.
As for your problem: How about just preventing the dragged vertex
from going underneath any (own class or other) object box.
I think that's how I'll fix this problem if I don't hear back.
Comment 5 Oliver Kellogg 2005-05-27 20:52:20 UTC
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);
Comment 6 Tony Parent 2005-05-27 21:03:17 UTC
You are too fast for me!

I would make sure that the vertex will never get under the class at all. My moving the vertex under the class was only a means of illistrating a point. I originally came up with the problem when I did a copy/paste from one class diagram to another. The associations get moved around, and some vertecies end up under classes. Most of the time it's not an issue as you can move the class out of the way to get to the vertex. The problem is when the vertex is part of an association attached to the class you need to move. Then the vertex moves with the class and you can never get to it. So if the above fix prohibits the copy/paste from doing the wrong thing, then closing is OK. 

Or do I need to open a bug report against the paste operation?

Keep up the good work.