|Re: Quartz Composer-like style [message #1764736 is a reply to message #1758093]
||Thu, 01 June 2017 21:31
| Ron Koerner
Registered: August 2010
After a while I actually came around implementing this. I got most of the things working, but I don't know if I did it the best way. So here are the problems I encountered and my solutions:|
I provided a null-feature for MoveAnchorFeature, but the anchor is still selectable and movable, it just cannot be dropped anywhere. Anyway, after adding a DragAndDropFeature, the problem is not visible anymore.
I first placed the FixedPointAnchor in an active nested Shape in the ContainerShape, but that caused buttons to appear around it, which I did not want. I solved that by just having one Shape for the whole Rectangle and everything else is either nested GraphicsAlgorithms or FixPointAnchors directly in the ContainerShape. FixedPointAnchor could really need some documentation. I also do not really understand what inactive shapes are for, as the same can be achieved with nested GraphicsAlgorithms.
My requirement is that a connector connecting on the left-hand side of the element has a tangent vector of (-1,0) and (1,0) on the right-hand side. This is very complicated to achieve when using a CurveConnector, as it would be necessary to reverse-engineer how it actually works. Is anyone actually using this? It would be ideal if there was a RoutedConnector which accepts a router, so users can make their own routing. While it probably would be possible to add a new connector type, it is discouraged as the class which would be overriden is marked with @noextend (or something like that). What I did was just using a FreeFormConnector with a lot of bend points that are arranged using a hermite spline. I also extended the MoveShapeFeature and LayoutFeature to update the bend points after moving/layouting. This works very nicely now.
- drag and drop was super easy, basically just a single line
- layouting is very complicated, it would probably benefit from some abstraction on top of the drawing primitives
- I haven't found a way to calculate the width of a Text. Is there one?
- I'm using DirectEditing, which works, but the Text field is apparently oriented TOP LEFT, while the actual text is CENTER CENTER. Is it possible to center the input field?
While I cannot share the full code, I can probably answer questions about my implementation and provide code snippets, if someone is interested.
|Re: Quartz Composer-like style [message #1765575 is a reply to message #1764736]
||Mon, 12 June 2017 14:17
| Michael Wenz
Registered: July 2009
Location: Walldorf, Germany
thanks for the feedback.
For what you wanted to achieve, the inactive shapes and GA nesting behave mostly the same, but there are other (sometimes subtile) differences that rectify both. But I agree that this is complicated and not easy to grasp. And there is for sure a shortage on documenation for this.
Graphiti does does not allow extending the list of connection types. That could be done, but was so far not requested. Adding a route connection type would be possible, but brings the user in rather close contact with GEF, that's why we did not add something like that. But it would of course be a very flexible connection type and I'm basically open for input or contributions here.
Layouting is an old topic that we wanted to address already a while ago, but did never get to it due to its complexity and limited resources for development. But, yes here Graphiti has a big improvement potential...
Text sizes can be calculated with a helper method: GraphitiUi.getUiLayoutService().calculateTextSize(text, textFont)
Regarding the direct editing, I don't think the orientation of the input field can be changed. But this should be aligned with what is set on Text GA side. So I would rather rate this as a bug. Would you file a bug for this?
Powered by FUDForum
. Page generated in 0.01755 seconds