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

wrong position of parent node #15

Closed
norflin321 opened this issue Jan 10, 2022 · 3 comments
Closed

wrong position of parent node #15

norflin321 opened this issue Jan 10, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@norflin321
Copy link

norflin321 commented Jan 10, 2022

My tree looks like this:
Screenshot 2022-01-10 at 19 23 33

json data

Webp net-resizeimage-3
[ { "id": "1", "gender": "male", "parents": [ { "id": "2", "type": "blood" }, { "id": "3", "type": "blood" } ], "siblings": [], "spouses": [], "children": [] }, { "id": "2", "gender": "male", "parents": [{ "id": "4", "type": "blood" }], "children": [{ "id": "1", "type": "blood" }], "siblings": [], "spouses": [{ "id": "3", "type": "married" }] }, { "id": "3", "gender": "female", "parents": [{ "id": "5", "type": "blood" }], "children": [{ "id": "1", "type": "blood" }], "siblings": [], "spouses": [{ "id": "2", "type": "married" }] }, { "id": "4", "gender": "male", "parents": [ { "id": "6", "type": "blood" }, { "id": "7", "type": "blood" } ], "children": [{ "id": "2", "type": "blood" }], "siblings": [], "spouses": [] }, { "id": "5", "gender": "male", "parents": [], "children": [{ "id": "3", "type": "blood" }], "siblings": [], "spouses": [] }, { "id": "6", "gender": "male", "parents": [], "children": [{ "id": "4", "type": "blood" }], "siblings": [], "spouses": [{ "id": "7", "type": "married" }] }, { "id": "7", "gender": "female", "parents": [], "children": [{ "id": "4", "type": "blood" }], "siblings": [], "spouses": [{ "id": "6", "type": "married" }] } ]


then I wanna add a new parent to node 5. I create new node with id 8, in his array of children add: { "id": "5", "type": "blood" }. In array of parents of node 5 add: { "id": "8", "type": "blood" }. Then tree doesn't look quite right, new node is hidden behind node 7:
Screenshot 2022-01-10 at 19 58 06

json data

Webp net-resizeimage-4
[ { "id": "1", "gender": "male", "parents": [ { "id": "2", "type": "blood" }, { "id": "3", "type": "blood" } ], "siblings": [], "spouses": [], "children": [] }, { "id": "2", "gender": "male", "parents": [{ "id": "4", "type": "blood" }], "children": [{ "id": "1", "type": "blood" }], "siblings": [], "spouses": [{ "id": "3", "type": "married" }] }, { "id": "3", "gender": "female", "parents": [{ "id": "5", "type": "blood" }], "children": [{ "id": "1", "type": "blood" }], "siblings": [], "spouses": [{ "id": "2", "type": "married" }] }, { "id": "4", "gender": "male", "parents": [ { "id": "6", "type": "blood" }, { "id": "7", "type": "blood" } ], "children": [{ "id": "2", "type": "blood" }], "siblings": [], "spouses": [] }, { "id": "5", "gender": "male", "parents": [{ "id": "8", "type": "blood" }], "children": [{ "id": "3", "type": "blood" }], "siblings": [], "spouses": [] }, { "id": "6", "gender": "male", "parents": [], "children": [{ "id": "4", "type": "blood" }], "siblings": [], "spouses": [{ "id": "7", "type": "married" }] }, { "id": "7", "gender": "female", "parents": [], "children": [{ "id": "4", "type": "blood" }], "siblings": [], "spouses": [{ "id": "6", "type": "married" }] }, { "id": "8", "gender": "male", "parents": [], "children": [{ "id": "5", "type": "blood" }], "siblings": [], "spouses": [] } ]


Is it possible to add single parent like this? Is it intensional behaviour or a bug? I tried on 3 last version of package.

@croonster
Copy link

I have the same issue. Is this something that could be looked at? Having a brief look through at the source code it seems like the "left" calculation goes wrong in this scenario. After you get to the 4th generation and attempt to add a parent on the right hand side of the tree the added node is superimposed on the left hand side.

@SanichKotikov
Copy link
Owner

@croonster hi. Thanks for the investigation. This lib is always open for pull requests (without changing the code style).

@SanichKotikov SanichKotikov added the bug Something isn't working label Jul 18, 2022
@SanichKotikov
Copy link
Owner

Fixed in v3.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants