drawio-desktop
drawio-desktop copied to clipboard
Automatic tree layout child nodes in wrong order
Preflight Checklist
- [x ] I agree to follow the Code of Conduct that this project adheres to.
- [x ] I have searched the issue tracker for a feature request that matches the one I want to file, without success.
You must agree to search and the code of conduct. You must fill in this entire template. If you delete part/all or miss parts out your issue will be closed.
Describe the bug Automatic tree layout child nodes in wrong order.
To Reproduce Steps to reproduce the behavior:
- Go to 'layout'
- Click on 'tree layout'
- Automatic tree layout child nodes in wrong orderr
Expected behavior When I set up automatic tree layout, the first-level child nodes behind the root node are not arranged in the order I placed them. How do I set this up?
Screenshots
draw.io version (In the Help->About menu of the draw.io editor):
- draw.io version v23.1.5
Desktop (please complete the following information):
- OS: Windows
Additional context
Use these buttons:
使用这些按钮:
hi, thank you for your answer.
I set up the nodes following this method, but the order still doesn't change. For example: the order of first-level child nodes from top to bottom is 1, 2, 3, 4, 5, 6. After applying automatic horizontal tree layout, the node order becomes 4, 5, 6, 1, 2.
Please add a screenshot or a test case
Please add a screenshot or a test case
Please see the use case at this link https://drive.google.com/file/d/1V57JOEN3czc2YlfgQmNcOx6yYw2FSM6Z/view?usp=sharing
请添加屏幕截图或测试用例
请通过此链接查看用例 https://drive.google.com/file/d/1V57JOEN3czc2YlfgQmNcOx6yYw2FSM6Z/view?usp=sharing
Supplement, I just forgot to set the editability of this file. Now it has been corrected and the test can be edited.
After a long period of debugging, I finally found the cause of the problem.
The ordering rules of child nodes in automatic tree layout are based on the creation time of the child node connecting lines. If I modify the properties of a sub-node connection line (for example: constraint direction, front and back position in graphics options), the creation time (sequence) of the connection line (sub-node) will be disrupted. If you reapply automatic tree layout at this time, the order of the child nodes will change to the order after changing the connection line properties.
I think this layout rule method is unreasonable, the user experience is very bad, and there are no relevant instructions in the user manual document. The sorting of child nodes in automatic layout is best sorted according to the xy coordinates of the child nodes.
The alternative I've found so far is to delete all related connecting lines and create new connecting lines for each related child node in the new order.
I'm a beginner in drawio and don't know if there is a better solution. If anyone has a better solution, I would be very grateful.
Ok there's a work around for this issue. The ordering rules are actually based on the date the child node was created and therefore the order of the child nodes in the definition. If you edit the XML for the diagram (save first) using Extras > Edit Diagram and change the order of the child nodes in there it will lay them out correctly.
Layout -> Customs... does't work on Windows 10 18362.1256
draw.io-24.7.5-windows-no-installer.exe
[ { "layout": "mxCircleLayout", "config": { "radius": 30, "x0": 100, "y0": 60, } } ]
But online version is ok.