[Spray] Problem with anchors [message #1385168] |
Wed, 04 June 2014 13:35  |
Eclipse User |
|
|
|
Hi all,
I will use pseudo code to describe the problem.
I have two shape definitions as follows:
Shape A {
anchor {
position (xoffset=0.5, yoffset=0.0) // middle-top
position (xoffset=0.5, yoffset=1.0) // middle-bottom
}
}
Shape B {
anchor {
position (xoffset=0.5, yoffset=0.0) // middle-top
position (xoffset=0.5, yoffset=1.0) // middle-bottom
}
}
I have a connection that connects these two types. Somehow, every new connection that is created ALWAYS attachs the 'middle-top' anchor.
Note that both anchor points are visible and I can alter the connections (source/target points) after that to attach to the middle-bottom anchor.
The problem comes from this method
protected Anchor getDslShapeAnchor(PictogramElement pe) {
if (pe == null) {
return null;
}
Shape dslShape = SprayLayoutService.findDslShape(pe);
if (dslShape != null) {
EList<Anchor> anchors = dslShape.getAnchors();
if (!anchors.isEmpty()) {
return anchors.get(0); //<-------- ALWAYS THE FIRST
}
}
return null;
}
that returns always the first anchor.
How do you solve this problem in Graphiti? I mean, how do you get the anchor closer to the mouse pointer?
Thanks for your help
Simone
|
|
|
|
|
Re: [Spray] Problem with anchors [message #1385813 is a reply to message #1385168] |
Wed, 11 June 2014 07:33  |
Eclipse User |
|
|
|
Hi Simone,
in plain Graphiti you would check the mouse location at the time the
connection is created and compare to the locations of the available anchors.
Then you would not use the anchor provided in the create connection context
(usually the chopbox anchor or the first anchor of the shape) but the one
you determined.
But I don't know if and how that procedure is applicable to Spray.
Michael
|
|
|
Powered by
FUDForum. Page generated in 0.03333 seconds