Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Can't correctly position anchor on the border of the shape
Can't correctly position anchor on the border of the shape [message #1718444] Wed, 23 December 2015 18:50 Go to next message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 561
Registered: November 2009
Senior Member
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.
http://i.imgur.com/nYYkpgT.png
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.
http://i.imgur.com/laJ23Ie.png
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 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1932
Registered: July 2009
Location: Walldorf, Germany
Senior Member
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 Go to previous message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 561
Registered: November 2009
Senior Member
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
Previous Topic:How to replace currently displayed diagram with another diagram
Next Topic:Disable moving an end connection
Goto Forum:
  


Current Time: Sat Nov 09 01:44:21 GMT 2024

Powered by FUDForum. Page generated in 0.02862 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top