in our editor, we have a lot of nodes with a label placed next to them, e.g. a circle with a label under it well outside the circle. Graphiti inherits GEF's good old clipping "feature", such that I have to use an invisible figure as a common container GA for label's Text and the Ellipse. Nevertheless, I want connections to connect to the Ellipse only.
I used a BoxRelative anchor with an (invisible) circle of the same size to achieve that and it works for connections. The problem is that this anchor now covers the figure in terms of selection, i.e. the figure is not selected when I click on it.
> I am not quite sure why you are creating a second invisible ellipse and
> not just set the referenced GA of the Anchor to the circle GA?
Correct me if I am wrong, but AFAIK the referenced GA of an Anchor is only used as a reference coordinate system for the placement and clipping of anchor's GA. This would not help me having edges at the border of the ellipse, as it deals with rectangular bounding boxes only.
Furthermore you *have to* set a child GA in a BoxRelativeAnchor otherwise you'll get NPEs. From what I know, the outline of this GA is the one defining where exactly the connecting point is located. So putting an ellipse will connect to the outline of the ellipse.
> Would a ChopBoxAnchor on the ellipse be an alternative?
You can only set anchors on PEs and the ellipse is a GA. Futhermore a chopbox anchor only takes the bounding box of the container's GA into account. That's why it doesn't need its own GA. It will once again not let connections touch the ellipse.
My current suspicion is that Graphiti just doesn't allow what I want to do. As it allows to drag an anchor for creating connections (as in the tutorial) anchors need to be selectable and that means I can only select the underlying PE where it exceeds the Anchor's bounds.
Some corrections: The ChopBoxAnchor of the ellipse would work if the ellipse was the GA of the root pictogram element.
Unfortunately that is not possible, because I need the invisible rectangle to put the label next to the ellipse, so the rect is the GA of the root PE.
I've also experimented with setActive on various shapes but to no extend.
Finally got the time to try Michael's proposal, but it doesn't work: The anchor is never passed to the DiagramToolBehaviorProvider.getSelection(PictogramElement, PictogramElement) method but it is still selectable in the diagram. Any other suggestions?