Reputation: 131
I need help with my project. I making ERD Diagram generator in HTML5, JS and CSS3. I miss only one function in my project, that is linking two objects(rectangles). I tried to make this function, but it only works straightforwardly but i want lines with 90 degrees angle.
For better exaplain, here is what i have now: https://i.sstatic.net/fpfKb.png
And this is what i want: https://i.sstatic.net/eCNKX.png
So here is function what want and i cant figure out:
This function must take 2 objects. Objects have Position X and Y, width and height. And function calculate best sides to link these two objects and 90 degrees angle in this objetcs.
So for example, it return:
(Start Point)Point1: 123,566
(Point where line wrap) Point2: 223,766
(Point where line wrap) Point3: 153,266
(End Point)Point4: 33,234
Any ideas? I only want suggestion of algorithm. Thanks guys :).
Upvotes: 2
Views: 1843
Reputation: 419
left
and which smaller top
value (if this is how you position them)left + width
of left objecttop + height/2
of left objectleft
of right objecttop + height/2
of right objectSorry for not posting code. If you post code of your example I can add it to answer.
Upvotes: 5