Community
Participate
Working Groups
The BorderedNode`s figure overlap their Parent. This behaviour creates problems when using an WorkspaceImage or an self-built EditPart/Figure because one has to create the image/figure with this in mind. Also the overlaping amount is not fixed so it depends on the size of the node.
(In reply to Max Schettler from comment #0) > Also the overlaping amount is not fixed so it depends on the size of the node. It should normally be fixed (to 8 pixels, see http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/tree/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/graphical/edit/styles/IBorderItemOffsets.java#n26). Do you have details on your use case where this is not the case?
Sorry it took me so long... It is fixed to 8 pixels, however due to this it is not possible to use a workspace image that is only displayed on the outside, because the image scales depending on the node`s size.
I'm not sure I understand what you mean by "a workspace image that is only displayed on the outside". Do you have a screenshot (or mockup) of the effect you want to obtain?
Created attachment 252766 [details] Image illustrating the overlapping The attachment should illustrate the problem: Both bordered Nodes use the same WorkspaceImage (The EditPart is custom for rotating the image, but uses the Sirius SVGWorkspaceImageFigure). On the bigger one the line fits with the border of the container. On the smaller image it overlaps with the containers shape. So I would have to create different images for all sizes, which also only works if the nodes are not resizable. Another issue is, that the overlapping is also dependent on the side, the BorderedNode is attached to. When the big "connector" is on the bottom of the container, the line will also overlap.
Thanks for the illustration, I understand the problem now. This is indeed a restriction of how Sirius right now, and there is currently no direct way to disable that. The only possible workarounds I see using the current code would be: 1. Disallow resizing of the bordered node in question. 2. Use the org.eclipse.sirius.diagram.ui.styleConfigurationProvider extension point to provide your own IBorderItemLocator via StyleConfiguration.getNameBorderItemLocator(). There is some documentation at https://www.eclipse.org/sirius/doc/developer/extensions-provide_custom_style.html but I'm not sure how up-to-date it is. 3. Given that you already provide a custom edit part, also provide a custom IFigure implementation programmed directly using Draw2D API, where you could probably determine programmatically the correct coordinates to pass to Graphics.drawLine() to make your figure connect exactly on the border. I understand these are not real solutions, but maybe they can help for the time being. A real solution would be to allow this "inset" to be configured directly in the VSM instead of hard-coded to "8 pixels", but the exact shape of such an enhancement will require some thinking/specification to make sure it would interact correctly with all the other features of Sirius diagrams. > Another issue is, that the overlapping is also dependent on the side, > the BorderedNode is attached to. When the big "connector" is on the bottom > of the container, the line will also overlap. This is more suprising. I don't think we have anything in our code which treats the top and bottom side differently in this respect (but I could be wrong). Could this come from your custom code for the image rotation?
Thanks for your reply. I think I will opt for the solution using the IBorderItemLocator as it seems to be the cleanest one. I do not think that the differences depending on the side of the image come from my EditPart because it just listens for events indicating change of the layout, computes which side the figure is on and rotates it. Anyway I will look more deeply into my code, maybe I can spot something.