|
Re: Connection figure display translated [message #225125 is a reply to message #225120] |
Wed, 25 October 2006 12:43 |
Eclipse User |
|
|
|
Originally posted by: nferry32.gmail.com
GetOwner() return the figure of the port connection.
I choice to attached the GEF Anchor concept to my ports figures.
My Anchor is saved in float in the model because I choice
relative coord. based on [0-1] x and y positionning related to the parent objet (like shape). So I can have
dynamic ports positionning.
public Point getLocation(Point ref) {
Rectangle bounds = getOwner().getBounds().getCopy();
getOwner().translateToAbsolute( bounds );
Point pos = new Point();
pos.x = (int)(bounds.x + bounds.width * anc.preciseX);
pos.y = (int)(bounds.y + bounds.height * anc.preciseY);
if( Math.abs( pos.getDistance2( ref ) - 10 ) < 0.001 )
return ref;
else
return pos;
}
This function return the position of the anchor if user click around 10 units distance.
|
|
|
|
Powered by
FUDForum. Page generated in 0.02723 seconds