Mini-Stef / Core-Data-Model-Editor

The place to get help, report problems or request feature on the Core Data Model Editor app.
https://github.com/Mini-Stef/Core-Data-Model-Editor
10 stars 1 forks source link

Improve layout of relationships if entities are above each other #7

Open vdhamer opened 10 months ago

vdhamer commented 10 months ago

Problem

If two entities are exactly or roughly above each other, a connecting relationship runs through the lowest entity's box. This would also apply for relationships between an entity and itself (e.g. parent to child relations in a hierarchy of Nodes).

Suggestion and Example

If EntityL is on the left and EntityR is clearly on the right, the rendering of the relationship connects EntityL.rightSide to EntityR.leftSide. This if fine.

But if EntityB is on the bottom and EntityT is on the top (but not clearly on the left or right), relationships should not connect EntityB.rightSide to EntitiyT.leftSide (or vice versa). Instead, it would be nicer to connect EntityB.rightSide and EntitiyT.rightSide (or EntityB.leftSide to EntityT.leftSide).

How to detect this? If the two boxes' x-ranges overlap.

How to choose which side? Choose the side with least amount of existing connections at that time (summed over both entities). In the example below, the connection between the two blue entities would then be on the right side rather than the left side. Global optimisation of avoiding crossing relationships might be possible, but require more work.

dataModel_to_be Screenshot 2024-01-22 at 00 41 17 Screenshot 2024-01-22 at 00 40 31 Screenshot 2024-01-22 at 00 50 01
Mini-Stef commented 10 months ago

Hello, Yes ! Will do in next version :-) Thanks again.