Let Connection end at midpoint of ContainerShape [message #1798834] |
Mon, 26 November 2018 13:47  |
Eclipse User |
|
|
|
Hey there!
I am trying to let a curved connection end at the midpoint of a ContainerShape. Currently we are using ChopBoxAnchors for the Start- and EndPoints of the connection.
The current situation looks like this:

I'm trying to achieve that the CurvedConnection ends in the middle of the point.
One solution I found was replacing the ChopBoxAnchors by BoxRelativeAnchors and set
boxRelativeAnchor.setRelativeHeight(0.5);
boxRelativeAnchor.setRelativeWidth(0.5);
This way the graphic is corrected but the selection on the containerShape (which here is represented by an ellipse) is not working anymore because the selection always (or mostly) selects the curve.
As i read in different posts the GEF-ConnectionLayer seems to be always on top of the shape-layer.
Does anyone have a suggestion on how to solve the selection behavior (so that BoxRelativeAnchors could work) or a different approach?
Thanks in advance and best regards!
Felix
|
|
|
|
Re: Let Connection end at midpoint of ContainerShape [message #1798972 is a reply to message #1798921] |
Wed, 28 November 2018 08:10   |
Eclipse User |
|
|
|
Hi Michael!
I tried your suggestion. Unfortunately the getSelection is only called from the ShapeEditPart, not from the ConnectionEditPart. So I don't see a way to prevent the selection of connections here.
Is there a way to prevent the selection of connections completely?
Regards,
Felix
|
|
|
Re: Let Connection end at midpoint of ContainerShape [message #1799035 is a reply to message #1798972] |
Thu, 29 November 2018 08:39   |
Eclipse User |
|
|
|
Hi Felix,
sorry, you are right of course. Changing the selection only works for shapes. Maybe we should add that for connections as well...?
Selection of connections can be disabled by returning false in method isConnectionSelectionEnabled() in your tool behavior provider.
Michael
|
|
|
Re: Let Connection end at midpoint of ContainerShape [message #1799058 is a reply to message #1799035] |
Thu, 29 November 2018 12:59   |
Eclipse User |
|
|
|
Hey Michael,
disabling connections by overwriting isConnectionSelectionEnabled() works. However, if I click at the location where a connection crosses a shape, nothing gets selected. My expectation would be, that the shape gets the selection.
It looks like a similar problem. In the select()-method of GrahpitiScrollingGraphicalViewer nothing is done in the else-bracket because the editpart is a FreeFormConnectionEditpart and the model a FreeFormConnection.
Is this a gap in graphiti or am I missing something?
Thanks a lot!
Felix
[Updated on: Thu, 29 November 2018 12:59] by Moderator Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.54974 seconds