Can't correctly position anchor on the border of the shape [message #1718444] |
Wed, 23 December 2015 18:50  |
Eclipse User |
|
|
|
I am following TutorialAddEClassFeature.java example to write my own feature. I think I am following correct references between shapes and rectangles, but can't position anchor correctly relative to invisible rectangle.
As you can see from this screenshot the anchor is placed on the edge on the inner rounded rectangle, but it's cut off because of the size of invisible rectangle.

This is not how I see things working in the tutorial example where anchor is positioned correctly on the edge of the rectangle and invisible rectangle is sized correctly.

I went line by line to compare my feature with TutorialAddEClassFeature but can't find anything that would be different.
Here is my class, perhaps someone can offer advise on what I am doing wrong.
Thanks,
Alex
|
|
|
Re: Can't correctly position anchor on the border of the shape [message #1718602 is a reply to message #1718444] |
Mon, 28 December 2015 08:26   |
Eclipse User |
|
|
|
Alex,
I only had a chance to have a short look, but it seems you place the inner rounded rectangle too far right. You use an xo-offset of 10, but the size of the inner rounded rectangle is only 10 pixels less than the outer invisible one; that leaves no space for the anchor of the right. Changing line 53 to
gaService.setLocationAndSize(roundedRectangle, 5, 5, width - 10, 40);
should do.
Michael
|
|
|
Re: Can't correctly position anchor on the border of the shape [message #1718641 is a reply to message #1718602] |
Mon, 28 December 2015 16:06  |
Eclipse User |
|
|
|
Michael,
Apologies, I think I didn't formulate my question correctly. In the Tutorial diagram type when I hover over the figure the location of button pad looks to be relative to inner figure, not invisible one; same as when I select the figure - the inner is selected, not the outer invisible one. In my case in both cases outer invisible figure is always selected...
As I was typing this question I realized that the only thing that might control this behavior is IToolBehaviorProvider, and that was it, public GraphicsAlgorithm getSelectionBorder(PictogramElement pe) is the method that controls this behavior, all is good now. Thanks!
Alex
|
|
|
Powered by
FUDForum. Page generated in 0.03272 seconds