Welcome to yEd Q&A!
Here you can ask questions and receive answers from other members of the community and yEd developers. And you can tell us your most wanted feature requests.

Categories

Non-Rectangle Nodes + Fit Node to Label = Poor Behavior

0 votes
"Fit Node to Label" does a poor job at fitting Diamond and Ellipse nodes to their labels. It looks as if the fitting algorithm is considering the node to be rectangular.

Because of this limitation, we end up not creating activity diagrams or process diagrams like we'd like to. We can't go around manually resizing diamond nodes each time we've run the Fit Node to Label function...
in Help by
recategorized by

1 Answer

0 votes
"Fit Node to Label" has an option to affect only selected nodes. Instead of running the tool on all of your nodes, run it only on your rectangular nodes.
by [yWorks] (160k points)
That would work, except the reason I have to rerun the resizing algorithm (and then the layout algorithms) in the first place is because I keep adding new nodes. In adding new nodes, I invariably destroy any node selection. That happens with each new tweak that I make to my diagram. Selecting a bunch of nodes from scratch every time I re-layout my diagram, and excluding some of the nodes, is not feasible. Imagine how intertwined the different types of nodes are in an activity diagram. Selection would be just as painful as manually resizing the nodes. I can't just draw a rectangle with my mouse, which would at least be a tractable problem; I have to instead control-click many times to get the right nodes selected.
No, you do not have to control-click many times to get the right nodes selected.
Open the "Current Elements" palette section, right-click the representative of a rectangular node type to open its context menu, and choose "Select Matching Elements". If you use the same node type with different fill colors, you might want to disable fill color as a distinctive feature for what constitutes "matching" elements. To do that, open the afforementioned context menu, choose "Configure Distinctive Features", and and disable check box "Fill Color".
Great, thank you for that insight. But you can see how this is still only a workaround. And it is still a costly workaround, having to open one more dialog and configuring it, when all I want is to re-layout my graph. It's pretty roundabout.

And it still leaves me having to manually size the diamond/ellipse nodes every time I add or edit them.

Beyond all that, the fact remains that "Fit Node to Label" does not properly resize ellipse and diamond nodes to fit the text. The text doesn't have an aesthetically pleasing distance from the edges of the node, and on occasion the text even spills out of the node. Workarounds or no workarounds, the problem that I'm reporting is that the Fit Node to Label is broken when it comes to certain non-rectangular nodes.

The solution seems simple: first find the bounding box for the text, complete with padding, like you probably do anyway (I submit as evidence for that the fact that the algorithm works for rectangular nodes), and then resize the diamond/ellipse so as to inscribe that bounding box. These are straightforward tweaks to the mathematical formulas for the ellipse radii or for the diamond diagonal(s).
Here is the actual behavior and the expected behavior: http://tinypic.com/r/nvshzd/9

For expected behavior, I allowed for the rectangle to not be fully inscribed, and I think that that makes sense aesthetically over inscribing it completely into the diamond.
Legal Disclosure | Privacy Policy
...