|freely positionable labels outside of labeled shape [message #1176751]
||Fri, 08 November 2013 14:31
| Martin Hanysz
Registered: November 2013
Hello Graphiti community,|
I am currently developing a diagram editor with Graphiti and am struggeling to place a label outside of a shape.
After a bit of research in this forum I found out that the "standard" way to achieve this is to use a ContainerShape with an invisible rectangle as its GraphicsAlgorithm that contains the Shapes for the label and the labeled element. But this method has two drawbacks:
1. The user should be able to move the label to whereever he wants it to be on the diagram. But due to the nesting of the label Shape it cannot be moved outside of its invisible ContainerShape. Even if it is possible to overcome this limitation, it would likely include a resize of the invisible ContainerShape, which leads to drawback #2.
2. The user must not be able to interact with the invisible ContainerShape by e.g. selecting it or dropping other elements "into" it. I know that I can adjust the selection behavior to "redirect" the selection to another PictoramElement if the invisible ContainerShape is clicked, but that would still select an element even though the user clicked on an apparently empty part of the diagram. Additionally, the invisible ContainerShape seems to overlap PictogramElements that were created before the invisible ContainerShape, thus the overlapped section would not select the visible element, but the target of the "redirection". The attached picture gives an illustration of the described setup.
It seems that making the invisible ContainerShape inactive is exactly what I need as it is not selectable, shapes cannot be dropped into it and it allows the label Shape to be placed anywhere on the diagram. But the problem with this method is that the diagram is not redrawn when Shapes that are nested in the inactive ContainerShape are moved or resized (to my surprise direct editing of the label works).
Finally, simply making two separate Shapes came to my mind, but the Graphiti Feature API seems to expect that an AddFeature always creates one Shape at a time so I didn't investigate that.
So my questions are:
1. What is the best way to have a freely positionable label outside of the labeled element?
2. If the answer to question 1 is having an invisible ContainerShape, how do I overcome the issues mentioned above?
3. Is there a way to trigger a redraw of the diagram when the children of an inactive Shape are moved or resized?
Thanks in advance for the help and best regards,
Powered by FUDForum
. Page generated in 0.05147 seconds