This may be a better way of doing it.
jqTree
jqTree
cdn
jqtree - Libraries - cdnjs - The #1 free and open source CDN built to make life easier for developers
You will also need to load jQuery.
https://releases.jquery.com
In the head file
<script src="https://code.jquery.com/jquery-3.6.1.min.js" integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqtree/1.6.3/tree.jquery.js"> </script>
A JS function called on scene load
var data = [
{
name: 'Beverages', id: 1,
children: [
{ name: 'Water', id: 2 },
{ name: 'Coffee', id: 3 },
{
name: 'Tea', id: 1,
children: [
{ name: 'Black Tea', id: 2 },
{ name: 'White', id: 3 ,children: [{ name: 'Green Tea', id: 4 ,children: [ { name: 'Sancha', id: 1 },
{ name: 'Gyokuro', id: 3 }, { name: 'Matcha', id: 4 }, { name: 'Pi Lo Chun', id: 5 } ] } ] }
]
}
]
}
];
$('#tree1').tree({
data: data,
autoOpen: true,
dragAndDrop: true
});
And on the scene a Rectangle with the id of #tree1
--
I would also suggest you look through the jsTree documentation to see how styling works.
I have not read it ( just glanced at the example pattern), so my use in id'd in the nodes may be wrong.
If you do upgrade then here is the file but the above should get you to the same stage.
tree.hype.zip (15.6 KB)