-
Notifications
You must be signed in to change notification settings - Fork 69
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
Error on node with 2 children #15
Comments
For those of you without programming skills, here's the solution in code. Thanks a lot, tgillet1!
|
works great so far. thanks |
Thank you very much! |
Thanks, this really helped! |
I just ran into this same problem, and also spent a while thinking I was doing it wrong! I've done a slightly different fix that handles both undefined left and right nodes, and opened a PR. Works for me (TM). |
Floppy's fix is a little more elegant: less lines of code, and works for more use cases. I'll add it here for reference.
|
Perhaps I misunderstood something in how to create an appropriate structure, but I found that when I had just 2 children for a node that an error occurred on line 523 of bubbletree.js. I found that on line 181 if node.right == node.left (when there are two nodes at the level), node.right is set to undefined. Then on line 523 node.right.amount is accessed but node.right is undefined, causing the error. I simply included a node.right==undefined check around the statement calculating rad2 and removed the node.right.amount component of the Math.max call in that case. My test case worked after making that change.
The text was updated successfully, but these errors were encountered: