Bug 120598 - Multiplicity labels positioned incorrectly when moving entities
Summary: Multiplicity labels positioned incorrectly when moving entities
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Oliver Kellogg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-22 14:14 UTC by Konstantin Savenkov
Modified: 2006-01-23 22:40 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Savenkov 2006-01-22 14:14:29 UTC
Version:           1.5.1 (using KDE 3.5.0, Debian Package 4:3.5.0-3 (testing/unstable))
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.12-1-686

1. Create a new Entity-Relationship diagram.
2. Create two entities (say A and B), connect them with relation.
3. Assign 1-1 multiplicity to the relation.
4. Move one of the entities (say A) around the screen.

Multiplicity label moves in one direction for different directions of moving the entity which it belongs to. Looks like direction on entity's movement calculated incorrectly, thus circular movement of the entity causes its multiplicity label to run far away from it.
Comment 1 Oliver Kellogg 2006-01-23 22:40:14 UTC
SVN commit 501786 by okellogg:

calculateTextPosition(): Revert commit 468001 from
http://www.geeksoc.org/~jr/umbrello/uml-devel/8974.html
Peter, could you take another look? Thanks.
BUG:120598


 M  +4 -1      ChangeLog  
 M  +7 -10     umbrello/associationwidget.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #501785:501786
@@ -1,6 +1,9 @@
 Version 1.5.2
 
-* fix problem reordering methods in classes/interfaces (http://bugs.debian.org/348940)
+* fix problem reordering methods in classes/interfaces (http://bugs.debian.org/348940,
+  http://bugs.kde.org/119991)
+* Bugs/wishes from http://bugs.kde.org:
+* Multiplicity labels positioned incorrectly when moving entities (120598)
 
 Version 1.5.1
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/associationwidget.cpp #501785:501786
@@ -1752,17 +1752,14 @@
     int x = 0, y = 0;
 
     if (role == tr_MultiA || role == tr_MultiB) {
+        const bool isHorizontal = (p.y() == q.y());
+        const int atTop = p.y() + SPACE;
+        const int atBottom = p.y() - SPACE - textH;
+        const int atLeft = p.x() - SPACE - textW;
+        const int atRight = p.x() + SPACE;
+        y = (p.y() > q.y()) == isHorizontal ? atTop : atBottom;
+        x = (p.x() < q.x()) == isHorizontal ? atRight : atLeft;
 
-        if( (p.y() > q.y()) != is_top_or_bottom )
-            y = p.y() + SPACE;
-        else
-            y = p.y() - SPACE - textH;
-
-        if( p.x() < q.x() != is_top_or_bottom )
-            x = p.x() + SPACE;
-        else
-            x = p.x() - SPACE - textW;
-
     } else if (role == tr_ChangeA || role == tr_ChangeB) {
 
         if( p.y() > q.y() )