Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic tree layout child nodes in wrong order #1650

Open
haiyulin opened this issue Mar 6, 2024 · 6 comments
Open

Automatic tree layout child nodes in wrong order #1650

haiyulin opened this issue Mar 6, 2024 · 6 comments

Comments

@haiyulin
Copy link

haiyulin commented Mar 6, 2024

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:

  1. Go to 'layout'
  2. Click on 'tree layout'
  3. 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

@alderg
Copy link
Contributor

alderg commented Mar 6, 2024

Use these buttons:
Screenshot 2024-03-06 at 06 34 30

@haiyulin
Copy link
Author

haiyulin commented Mar 6, 2024

使用这些按钮: 屏幕截图 2024-03-06 于 06 34 30

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.

@alderg
Copy link
Contributor

alderg commented Mar 6, 2024

Please add a screenshot or a test case

@haiyulin

This comment was marked as duplicate.

@haiyulin
Copy link
Author

haiyulin commented Mar 6, 2024

请添加屏幕截图或测试用例

请通过此链接查看用例
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.

@haiyulin
Copy link
Author

haiyulin commented Mar 6, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants