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

Collapsing LiteGUI.Tree #6

Open
cppctamber opened this issue Dec 17, 2016 · 0 comments
Open

Collapsing LiteGUI.Tree #6

cppctamber opened this issue Dec 17, 2016 · 0 comments

Comments

@cppctamber
Copy link

cppctamber commented Dec 17, 2016

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);
}
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

1 participant