Skip to content

Collapsing LiteGUI.Tree #6

@cppctamber

Description

@cppctamber

Should tree nodes be able to collapse by default, or do I need to supply a setting to enable?

image

Example Code:

function overview(side)
{
    var tabs = new LiteGUI.Tabs("some_tab");
    
    tabs.addTab("tree", {
        selected: true, 
        width: "100%", 
        height: 400, 
        // collapsed : true  // Doesn't seem to do anything
    });
    
    let treeContent = tabs.getTabContent("tree");

    var myTree =
    {
        id: "root",
        children: [
            {id: "Scene"},
            {id: "Sun"},
            {
                id: "Cameras",
                children: [
                    {id: "Camera 1"},
                    {id: "Camera 2"},
                    {id: "Camera 3"}
                ]
            },
            {
                id: "Planets",
                children: [
                    {id: 'Planet 1'},
                    {id: 'Planet 2'},
                    {id: 'Moon'}
                ]
            },
            {
                id: "Stations",
                children: [
                    {id: 'Station 1'},
                    {id: 'Station 2'},
                    {id: 'Station 3'},
                    {id: 'Station 4'}
                ]
            }
        ]
    };

    var liteTree = new LiteGUI.Tree("tree", myTree, {allow_rename: true});

    LiteGUI.bind(liteTree, "item_selected", function (e, node)
    {
        console.log("Node selected: " + node);
    });

    treeContent.appendChild( liteTree.root );
    
    side.add(tabs);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions